Skip to Content Skip to Menu

CBAuthorBot Hack - Show CB Avatar in articles

  • zen
  • zen
  • OFFLINE
  • Posts: 61
  • Thanks: 5
  • Karma: 1
18 years 1 week ago #22436 by zen
To follow up on redlaguna's inquiry, has anyone succeeded in incorporating this hack with Mamblog?

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

  • bjraines
  • bjraines
  • OFFLINE
  • Posts: 87
  • Thanks: 0
  • Karma: 2
17 years 11 months ago #23025 by bjraines
Phleum wrote:

Here's another tweaking. It's based on above and some of the other things in this thread. This version has the controls from the one above, plus pulls an additional field from community builder (in my case, it's cb_biography). and sticks it under the avatar. city would work, as someone had previously requested.

It's probably redundant the way I did the queries- I don't know PHP/MySQL well. If anyone can clean it up, great. It seems to be working for me, though.

[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;

// a few configs
$query = "SELECT cb_biography FROM #__comprofiler WHERE user_id = $row->created_by AND avatarapproved = '1'";
$database->setQuery( $query );
$cb_biography = $database->loadResult();
$caption = $cb_biography; // caption below author image
$show_all = false; // set to true to show author image everywhere

// allow usage of <!-- !CBAuthorBot --> to NOT show the author bot details
if(strstr($row->text, "!CBAuthorBot"«»)){
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 ) {
$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]



Has anyone got this version to work. I keep getting a STRING error? Thanks.

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

  • zen
  • zen
  • OFFLINE
  • Posts: 61
  • Thanks: 5
  • Karma: 1
17 years 11 months ago #23437 by zen
This may be a content.html.php-related issue rather than CBAuthorBot.php, but how can I move the article title from top of the avatar to the right side of it, above the article text?

The attached pic shows the article title 'test blog 3' above the avatar. I need to move this title to the right side of the avatar and above the article text.

TIA



Post edited by: zen, at: 2006/10/28 00:51
Attachments:

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

  • zen
  • zen
  • OFFLINE
  • Posts: 61
  • Thanks: 5
  • Karma: 1
17 years 11 months ago #23473 by zen
In other words, I need to move the hacked CBAuthorBot before the blog article title.

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

  • merdok
  • merdok
  • OFFLINE
  • Posts: 1
  • Thanks: 0
  • Karma: 0
17 years 11 months ago #23735 by merdok
This is more or less what I would like to do as well... I would like my articles to look like this:

Attachments:

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

  • bjraines
  • bjraines
  • OFFLINE
  • Posts: 87
  • Thanks: 0
  • Karma: 2
17 years 11 months ago #24333 by bjraines
Replied by bjraines on topic Added profile fied
This is nothing big but I don't think anyone did this yet. I added a profile fied in which users can put a short "bio" like found in article indexes and some blogs like About.

You can see it at my test site www.macongoodtimes.com (no worries this is not a lame attempt to promote this. It has no content)

If anyone is interested I will attach the code. I am just at work now.

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

Moderators: beatnantkrileon
Powered by Kunena Forum