| 
Welcome, Guest

CBAuthorBot Hack - Show CB Avatar in articles
(1 viewing) (1) Guest

TOPIC: CBAuthorBot Hack - Show CB Avatar in articles

CBAuthorBot Hack - Show CB Avatar in articles 5 years, 10 months ago #9096

  • Posts:
  • Karma:
If you change the code in CBAuthorBot.php to the following, it will show the author's picture in the content. You can see it in action at www.lovelearnlive.com

If you use this and find it useful, please post here and let me know. I want to know that this is useful for more than just me. Some Karma would be nice too, but it's not necessary.

<?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 : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1 $
**/

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;
 
//var_dump($row);
 
$query = "SELECT avatar FROM #__comprofiler WHERE user_id = $row->created_by AND avatarapproved = '1'";
$database->setQuery( $query );
$avatar = $database->loadResult();
$avatarlink = "";
$txt = "";
if ( $avatar ) {
$avatarlink = $mosConfig_live_site.'/images/comprofiler/tn'.$avatar;
$txt = "<a href=\"".sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$row->created_by)."\"><img src=\"$avatarlink\" border=\"0\" align=\"left\" class=\"authorimg\" /></a>";
}
$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>";
$row->text = $txt.$row->text;
//return $txt;
 
//<div class=\"authorimg\"></div>
//echo $row->created_by_alias;
}
 
 
?>


Post edited by: ccdog, at: 2006/03/27 05:29

Post edited by: ccdog, at: 2006/03/27 17:26

Re:CBAuthorBot Hack - Show CB Avatar in articles 5 years, 10 months ago #9101

  • Posts:
  • Karma:
I copied your code and pasted it into the .php file and it didn't work... not sure why, it looks great on your site, though!
Joomla 1.0.8 + CB Stable

Re:CBAuthorBot Hack - Show CB Avatar in articles 5 years, 10 months ago #9123

  • Posts:
  • Karma:
OK, I think I just figured it out...

Wherever it says
$mosConfig_livesite

you need to change that to
$mosConfig_live_site


Post edited by: ccdog, at: 2006/03/27 16:36

Re:CBAuthorBot Hack - Show CB Avatar in articles 5 years, 10 months ago #9143

  • Posts:
  • Karma:
Indeed... great work! Now all I have to do is style the css

Thanks! Karma goes...

up! haha
Joomla 1.0.8 + CB Stable

Re:CBAuthorBot Hack - Show CB Avatar in articles 5 years, 10 months ago #9161

  • Posts:
  • Karma:
I'm glad you like it...Thanks for the karma!

On a side note...

You probably already noticed this, but I put class="authorimg" in the "<img..." tag. So, if you want to style the picture, you simply have to use:

img.authorimg {
...
}

Re:CBAuthorBot Hack - Show CB Avatar in articles 5 years, 10 months ago #9162

  • Posts:
  • Karma:
sure did, thanks!
Joomla 1.0.8 + CB Stable
Time to create page: 1.13 seconds