Skip to Content Skip to Menu

CBAuthorBot Hack - Show CB Avatar in articles

  • ccdog
  • ccdog
  • OFFLINE
  • Posts: 21
  • Thanks: 0
  • Karma: 21
18 years 5 months ago #11868 by ccdog
@peerlink

OK, try this:

[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 $
**/
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, cb_city FROM #__comprofiler WHERE user_id = $row->created_by AND avatarapproved = '1'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$row = $rows[0];
$avatar = $row->avatar;
$cb_city = $row->cb_city;
$avatarlink = "";
$txt = "";
if ( $avatar ) {
$avatarlink = $mosConfig_live_site.'/images/comprofiler/tn'.$avatar;
$txt = "<div class=\"akoauthorimg\"><a href=\"".sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$row->created_by)."\"><img src=\"$avatarlink\" border=\"0\" align=\"left\" class=\"authorimg\" /></a><br />$cb_city</div>";
}
$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;
}


?>

[/code:1]

I have not tested this solution, but give it a try and see if it does what you want it to.

You will have to modify your CSS file to get it exactly how you want it. It puts the image and cb_city within a div with the class name akoauthorimg.

I hope this works for you :)

Please Log in or Create an account to join the conversation.

  • ffaabbss
  • ffaabbss
  • OFFLINE
  • Posts: 94
  • Thanks: 0
  • Karma: 6
18 years 4 months ago #13787 by ffaabbss
Bummer... somehow that hack doesn't work for me.. no images show up in articles... did somebody say before this didn't work in mamblog?

Please Log in or Create an account to join the conversation.

  • ccdog
  • ccdog
  • OFFLINE
  • Posts: 21
  • Thanks: 0
  • Karma: 21
18 years 4 months ago #13800 by ccdog

Bummer... somehow that hack doesn't work for me.. no images show up in articles... did somebody say before this didn't work in mamblog?


This probably won't work in Mamblog because Mamblog does not display Mambots. It should work with regular content items.

Please Log in or Create an account to join the conversation.

18 years 4 months ago #13830 by ericfoster3
Replied by ericfoster3 on topic Re:CBAuthorBot Hack - Show CB Avatar in articles
Is there any way to make the avatar show ONLY on the full story, and not on the front page, or the blog view?

CB 3rd Party Developer: DatsoTab | KarmaTab
Joomla! 1.0.10
Community Builder 1.0
joomlaboard 1.1.2

Please Log in or Create an account to join the conversation.

  • stevebor1
  • stevebor1
  • OFFLINE
  • Posts: 28
  • Thanks: 0
  • Karma: 235
18 years 4 months ago #13876 by stevebor1
Replied by stevebor1 on topic Re:CBAuthorBot Hack - Show CB Avatar in articles
I really like what's going on here. your lovelearnlive.com site looks great.

I am interested in having the ability to enter in a users name/id the same way instead of just the author, kinda like {cbauthorbot_61} or even ditch the auhor part ;)

because i write the articles, but feature members i want to link to. check out my pic :) I'll start a new thread if we get this going :)



Post edited by: stevebor1, at: 2006/05/25 10:24

Karma Me Up!
[img


FITcommunity
Joomla! 1.0.12 - Community Builder 1.0.2 - Joomlaboard 1.1.2
Own Mods Featured Profile Mod
My Real Day Job
[img

Mobile Wallet and Social Lending, Anywhere!
Attachments:

Please Log in or Create an account to join the conversation.

  • ccdog
  • ccdog
  • OFFLINE
  • Posts: 21
  • Thanks: 0
  • Karma: 21
18 years 4 months ago #13925 by ccdog
ericfoster3 wrote:

Is there any way to make the avatar show ONLY on the full story, and not on the front page, or the blog view?


I'm sure this is possible. You might try looking at the code for AKOCommentBot, and see how it accomplishes showing different things based on whether it is on the full sotry or front page/blog view.

stevebor1 wrote:

I really like what's going on here. your lovelearnlive.com site looks great.


Thanks! The kids in our youth group really seem to like it. It gives them an alternative to Xanga/MySpace.

I am interested in having the ability to enter in a users name/id the same way instead of just the author, kinda like {cbauthorbot_61} or even ditch the auhor part

because i write the articles, but feature members i want to link to. check out my pic I'll start a new thread if we get this going


I'm not sure what you are asking for here, but it sounds like a lot of work. I'm kind of limited on time right now, but maybe someone else can take a look at the hack that I did and modify it to suit your needs. All it amounts to is an SQL query and some presentation logic.

Good luck!

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum