Skip to Content Skip to Menu

CBAuthorBot Hack - Show CB Avatar in articles

  • garciad
  • garciad
  • OFFLINE
  • Posts: 1
  • Thanks: 0
  • Karma: 1
16 years 3 months ago #68889 by garciad
I tested several ways of this hack, but I have a little question. I use the original hack sent by ccdog.
The hacks it's ok, but I want to know if there is a way to show the avatar in the intro of the article too.

In the way it is, it shows me the avatar only when I click on "Read More" and the full article opens. I want to show when the article is in the "intro" view, and when the article is in the "full view".

Is there a way to do this?

Thanks a lot to all!

GUe.

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

  • MMPatriko
  • MMPatriko
  • OFFLINE
  • Posts: 2
  • Thanks: 0
  • Karma: 0
16 years 1 month ago #72554 by MMPatriko
Replied by MMPatriko on topic Re:CBAuthorBot Hack - Show CB Avatar in articles
Hey ccdog,

Great work on getting the avatars into articles. I'm wondering if it's possible to hide the avatar on certain articles once we've used your method. At the moment the avatar shows on all articles written by the user, even after hiding fields such as "Author Name" etc. This is great for blogs, but not when we want to make informational/static pages.

I've found a work around however. I just set the author to Administrator for now. But just thought you'd like to know if you want to add more functionality to your hack. :)

Again great work.

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

  • cherold
  • cherold
  • OFFLINE
  • Posts: 1
  • Thanks: 0
  • Karma: 0
16 years 2 weeks ago #76128 by cherold
I hope this topic is still active, or someone responds soon...

I've installed the CB Author plugin and hack. It's implemented here: www.wmgt.com/index.php?option=com_content&task=view&id=2697&Itemid=103

But as you can see, there is a massive list of errors on the right hand side of the page. They say this:

[code:1]DB function failed with error number 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND avatarapproved = '1'' at line 1 SQL=SELECT avatar FROM jos_comprofiler WHERE user_id = AND avatarapproved = '1'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'AND avatarapproved = \'1\'\' at line 1 SQL=SELECT avatar FROM jos_comprofiler WHERE user_id = AND avatarapproved = \'1\' [/code:1]

The CBAuthorbot.php file currently looks like 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 $
* 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/tn'.$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\" align=\"left\" hspace=\"10\" vspace=\"5\" /><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]

Any help please?? It would be greatly appreciated!

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

  • bazil
  • bazil
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
15 years 10 months ago #80629 by bazil
I notice, that on many of the sites this is running on, the avatars show up for the users' comments. That is really where I want to have the avatars, in the comments section of articles.

Any help, any at all, would be much appreciated. Again, I don't want the avatars for the article author, I want them for the comment authors.

Thank you,
Bazil

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

  • Filho
  • Filho
  • OFFLINE
  • Posts: 11
  • Thanks: 0
  • Karma: 3
15 years 10 months ago #80636 by Filho
Hi bazil, !JoomlaComment do it for yourself. See an example in my site . ;)

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

  • bazil
  • bazil
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
15 years 10 months ago #80659 by bazil
You, good sir, rock! Thank you for the link, this works great!

Filho wrote:

Hi bazil, !JoomlaComment do it for yourself. See an example in my site . ;)

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

Moderators: beatnantkrileon
Powered by Kunena Forum