How-To Categories
Recent How-To's
News Feed E-mail
Login
| CBAuthorBot Hack |
|
|
|
| Written by Cory | |
| Wednesday, 13 September 2006 | |
|
If you use Community Builder (CB) and the CBAuthorBot (the one that makes the author's name linkable to their CB Profile), then you might be interested in this hack. It enables you to display the author's CB avatar at the top of an article with a link back to his or her CB profile. I originally posted it here on the CB website. You can go there for more information, and to see how other people have modified the hack. Here's the code: <?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; } ?>
Set as favorite
Bookmark
Email This
Hits: 4688 Trackback(0)
Comments (12)
![]()
Jom: ... http://www.google.com
Thanks for the post!
1 report abuse
vote down
vote up
June 02, 2007
Votes: +0
Ron: ...
Fantastic hack!
I was looking everywhere for this. Thank You Thank You! ![]() 2 report abuse
vote down
vote up
August 18, 2007
Votes: +0
Mika: ...
Where can we find the CBAuthorBot?? In what file is that?..
![]() 3 report abuse
vote down
vote up
October 18, 2007
Votes: +0
Mika: ...
where is that CBAuthorBot.php?.... is it already present in the CB files? or.. where can I download it.???
5 report abuse
vote down
vote up
October 18, 2007
Votes: +0
Mika: ...
where can i download this bot? pls???
6 report abuse
vote down
vote up
October 18, 2007
Votes: +0
Janosch71: ...
Hi,
thank you very much for this hack. One question: you wrote: You probably already noticed this, but I put class="authorimg" in the " 8 report abuse
vote down
vote up
October 20, 2007
Votes: +0
fabs: ... http://www.ffaabbiiaann.de
Hi Cory!
Is there a way to only show the avatar if "show author" is actually enabled for the menu item? I have a blog section link where i said "show author" and another blog section where i do not want to show authors. So I would need to have the bot check whether "show author" is enabled for a blog category, blog section or content item... how can that be done? could you help me out here? Thanks Fabs 9 report abuse
vote down
vote up
November 11, 2007
Votes: +0
fabs: ... http://www.ffaabbiiaann.de
I just found out that caldate mambot can be displaye on some sections categories or page only. http://extensions.joomla.org/c...Itemid,35/
Cory, do you think you could add the corresponding code snippets for us to enhance cbauthorbot? 10 report abuse
vote down
vote up
November 11, 2007
Votes: +0
fabs: ... http://www.ffaabbiiaann.de
i tried to do the merge myself... only parse errors adn missing functions. no experience, sorry. hope you can help
11 report abuse
vote down
vote up
November 11, 2007
Votes: +0 Write comment
|
| < Prev |
|---|










