Wow- lots of activity since I last checked. here's my version, for what it's worth. It's implemented here:
massmees.org/index.php?option=com_content&task=category§ionid=4&id=164&Itemid=540
It's simple: avatar on top, bio below (if available) in box on top left, wrapped by text.
It *should* return either the av, the bio, or both, depending on the user profile. This version requires a CB field "cb_bio" (hardcoded). It would be cool if the choice of field(s) was configurable through parameters. Even better if the whole layout was configurable. Maybe that get into the realm of the module I've read about here...
We use author alias a bunch, so I wrote it to ignore the author if it's the main admin(62).
If you want to hide it from a content item, use the call {!Bio!} or {nobio!} in the item.
Maybe it will help someone...
[code:1]
<?php
/**
* CB Link 2 author mambot
* @package Community Builder
* @subpackage CB Link 2 author mambot
* @Copyright (C) MamboJoe
* @ All rights reserved
* @ Released under GNU/GPL License :
www.gnu.org/copyleft/gpl.html
* @version $Revision: 1 $
* modified by ccdog then phleum to add author avatars and captions
* -- this version requires a CB field "cb_bio" to function properly
**/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$_MAMBOTS->registerFunction( 'onBeforeDisplayContent', 'CBAuthorBot');
function CBAuthorBot (&$row, &$params, $page) {
global $database, $mosConfig_live_site;
// a few configs
$query = "SELECT cb_bio FROM #__comprofiler WHERE user_id = $row->created_by";
$database->setQuery( $query );
$cb_bio = $database->loadResult();
$caption = $cb_bio; // caption below author image
$show_all = false; // set to true to show author image everywhere
// Do not show general admin-- hardcoded to admin id
if ($row->created_by != 62) {
// allow usage of <!-- !Bio! --> to NOT show the author bot details
if(strstr($row->text, "!Bio!"«»)){
print str_replace("{!Bio!}", "", $row->text);
return;
}
// allow usage of <!-- !bio! --> to NOT show the author bot details
if(strstr($row->text, "nobio!"«»)){
print str_replace("{nobio!}", "", $row->text);
return;
}
$task = mosGetParam($_REQUEST, 'task', false);
$option = mosGetParam($_REQUEST, 'option', false);
//var_dump($row);
if ( ( ($option == 'com_content' || $option == 'content') && $task == 'view') || $show_all) {
$query = "SELECT avatar FROM #__comprofiler WHERE user_id = $row->created_by AND avatarapproved = '1'";
$database->setQuery( $query );
$avatar = $database->loadResult();
$avatarlink = "";
$txt = "";
if ( $avatar || $cb_bio ) {
$avatarlink = $mosConfig_live_site.'/images/comprofiler/'.$avatar;
$txt = "<div class=\"author_profile\"><a href=\"".sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$row->
created_by)."\" align=\"left\"><img src=\"$avatarlink\" border=\"0\"class=\"authorimg\" /><div class=\"authorimg_caption\">$caption</div></a></div>";
}
$row->text = $txt.$row->text;
}
$row->created_by_alias="<a href=\"".sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$row->created_by)
."\">".($row->created_by_alias!='' ? $row->created_by_alias : $row->author)."</a>";
}
}
[/code:1]