Skip to Content Skip to Menu

CBAuthorBot Hack - Show CB Avatar in articles

  • ffaabbss
  • ffaabbss
  • OFFLINE
  • Posts: 94
  • Thanks: 0
  • Karma: 6
17 years 1 month ago #47233 by ffaabbss
simi wrote:

Is there any way to make a module like here (at the right)?
hxxp://www.kimyamuhendisi.com/index.php?option=com_content&task=view&id=52&Itemid=1

Post edited by: simi, at: 2007/07/13 13:14

that would be really interesting indeed? How is that done?

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

  • ccdog
  • ccdog
  • OFFLINE
  • Posts: 21
  • Thanks: 0
  • Karma: 21
17 years 1 month ago #47305 by ccdog
ffaabbss wrote:

simi wrote:

Is there any way to make a module like here (at the right)?
hxxp://www.kimyamuhendisi.com/index.php?option=com_content&task=view&id=52&Itemid=1

Post edited by: simi, at: 2007/07/13 13:14

that would be really interesting indeed? How is that done?


Hi guys,

Here's how I think you would do this.

1) Create a module. In that module, do the following:
2) Test to see if you are on a content item page (check the GET parameters from the URL for option=com_content and task=view)
3) Get the content id from the URL (it should say "id=x" where x is some number)
4) Get the data from the #_content table in the database where id is equal to the content id you found in step 3
5) Check that data for the author id
6) Use the author id to generate a link to the author's profile and get the thumbnail image of the author.
7) Only publish the module on pages that have content items.

If someone feels like coding this, that would be great. I'm sure it would be most appreciated by the community! :)

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

  • bjraines
  • bjraines
  • OFFLINE
  • Posts: 87
  • Thanks: 0
  • Karma: 2
17 years 1 month ago #47319 by bjraines
i could code this , this week as soon as I finish my auction ads sharing module

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

  • ccdog
  • ccdog
  • OFFLINE
  • Posts: 21
  • Thanks: 0
  • Karma: 21
17 years 1 month ago #47415 by ccdog
bjraines wrote:

i could code this , this week as soon as I finish my auction ads sharing module


Great, thanks! I look forward to seeing it.

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

17 years 3 weeks ago #48867 by toplumdusmani
Replied by toplumdusmani on topic Re:CBAuthorBot Hack - Show CB Avatar in articles
ccdog wrote:

ffaabbss wrote:

simi wrote:

Is there any way to make a module like here (at the right)?
hxxp://www.kimyamuhendisi.com/index.php?option=com_content&task=view&id=52&Itemid=1

Post edited by: simi, at: 2007/07/13 13:14

that would be really interesting indeed? How is that done?


Hi guys,

Here's how I think you would do this.

1) Create a module. In that module, do the following:
2) Test to see if you are on a content item page (check the GET parameters from the URL for option=com_content and task=view)
3) Get the content id from the URL (it should say "id=x" where x is some number)
4) Get the data from the #_content table in the database where id is equal to the content id you found in step 3
5) Check that data for the author id
6) Use the author id to generate a link to the author's profile and get the thumbnail image of the author.
7) Only publish the module on pages that have content items.

If someone feels like coding this, that would be great. I'm sure it would be most appreciated by the community! :)


[code:1]<?
/**
Community Builder - Author Info!
@author bigodines
@date April, 2005
@description Este mambot acrescenta uma pequena tabela com as informações do autor quando for digitada a tag {mosauthorinfo}
@requirements Community Builder 1.4 or higher
@package Mambo_4.5.2.1
*/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );


/* Vou registrar meu mambot :«»D */
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botAuthorInfo' );

/**
Essa função verifica se a tag {mosauthorinfo} existe no conteúdo. Se existir, troca por uma tabela com
as informações do autor daquele conteúdo.
*/
function botAuthorInfo( $published, $row, $mask=0, $page=0 ) {
global $database;

if (!$published) {
return true;
}

// define the regular expression for the bot
$expressao = "#{mosauthorinfo}#s";
//echo "<pre>";
//print_r($row);
//echo "</pre>";
/* PARA USO EM OUTROS CASOS QUE NÃO O MAMBOPROS.NET, TROCAR OS CAMPOS DO SELECT PARA OS
CAMPOS DESEJADOS DO COMMUNITY BUILDER */
$database->setQuery("SELECT cb_firstname, cb_lastname, avatar, user_id, username, email, occupation, cb_website, interests, city, SUM( notas.rating_sum ) / SUM( notas.rating_count ) as media
FROM #__comprofiler AS perfil
LEFT JOIN #__users AS user ON user_id = perfil.user_id
LEFT JOIN #__content AS c ON c.created_by = perfil.id
LEFT JOIN #__content_rating AS notas ON notas.content_id = c.id
WHERE perfil.id = '$row->created_by'
GROUP BY cb_firstname"«»);

//$database->setQuery("SELECT * FROM #__users WHERE id = $row->created_by"«»); // teste local

$linha = null;
$database->loadObject( $linha );
$html = "<table width=\"180\" border=0 align=\"left\"><tr><td align=\"left\"><table width=\"175\" style=\"border: 1px solid silver\" bgcolor=\"#F5F5F5\" cellpadding=\"2\">\n";
$html .= "<tr><td><b>Yazar Bilgisi:</b></td></tr>";
if ($linha->avatar)
$html .= "<tr><td align=\"center\" bordercolor=\"#F0F0F0\"><img src=http://www.yoursite.com/images/comprofiler/".$linha->avatar.">";
if ($linha->cb_firstname)
if ($linha->cb_website)
//Na proxima linha vo tentar mostrar o perfil pra visitantes, assim qeu descobrir como =P
//$html .= "<tr><td bordercolor=\"#F0F0F0\">Name: <a href=http://www.yoursite.com/index.php?option=com_comprofiler&task=userProfile&user=".$linha->user_id." &lang=\" target=\"_blank\">".$linha->cb_firstname." ".$linha->cb_lastname."";
$html .= "<tr><td bordercolor=\"#F0F0F0\">Adı&Soyadı: ".$linha->cb_firstname." ".$linha->cb_lastname."</td></tr>";
$html .= "<tr><td bordercolor=\"#F0F0F0\">Üye Adı: ".$linha->username."</td></tr>";
$html .= "<tr><td bordercolor=\"#F0F0F0\">Şehir: ".$linha->city."</td></tr>";
$html .= "<tr><td bordercolor=\"#F0F0F0\">Gönderi Sayısı: ";
$html .= $linha->media ? $linha->media * 2 : "0.00" ;
$html .= "</td></tr>";
//if ($linha->apresentacao)
$html .= "<tr><td bordercolor=\"#F0F0F0\">Yazar Hakkında: <i>".$linha->interests."</i></td></tr>";
$html .= "<tr><td bordercolor=\"#F0F0F0\">Yazarın: <a href=http://www.yoursite.com/index.php?option=com_comprofiler&task=userProfile&user=".$linha->user_id.">Profili";
$html .= "<tr><td bordercolor=\"#F0F0F0\">Yazarın: <a href=http://www.yoursite.com/index.php?option=com_mhauthor&task=show&auth=".$linha->user_id.">Diğer Yazıları";
$html .= "</td></tr></table></table>";

//echo "<pre>";
//print_r($linha); // debug
//echo "</pre>";


$html;

// vamos trocar!
$row->text = preg_replace( $expressao, $html, $row->text );

// beleza. retorno true para que o mambo continue fazendo o que deve ser feito.
return true;

}

?>[/code:1]
This is mosauthorinfo.php

[code:1]<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall version="4.5.2" type="mambot" group="content">
<name>mosauthorinfo</name>
<author>Matheus Mendes</author>
<creationDate>April - 2005</creationDate>
<copyright>(C) 2005 </copyright>
<license> www.gnu.org/copyleft/gpl.html GNU/GPL
<authorEmail>bigodines at gmail.com</authorEmail>
<authorUrl> www.joomla.com.br
<version>1.0</version>
<description>Add author's info to content</description>
<files>
<filename mambot="mosauthorinfo">mosauthorinfo.php</filename>
</files>
<params/>
</mosinstall>[/code:1]

This is mosauthorinfo.xml



Hi
I want to convert this mambot to modul or I want show in the left block this mambot. What can I do?

Post edited by: toplumdusmani, at: 2007/10/27 23:21

Post edited by: toplumdusmani, at: 2007/10/27 23:22

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

17 years 3 weeks ago #48880 by toplumdusmani
Replied by toplumdusmani on topic Re:CBAuthorBot Hack - Show CB Avatar in articles
mambot demo: nedirr.com/index.php?option=com_content&task=view&id=6&Itemid=2

now demo mambot code in the content: [code:1]<p style="left: 605px; width: 100px; position: absolute; top: 118px; height: 100px">{mosauthorinfo}</p>[/code:1]

I think it's bad code. I want convert this mambot to modul..! help me..

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

Moderators: beatnantkrileon
Powered by Kunena Forum