Plugin cbauthorprofile

  • victoroots
  • Avatar de victoroots Autor do Tópico
  • Offline
  • JCB! Novato
  • JCB! Novato
Mais
13 anos 1 mês atrás #46385 por victoroots
victoroots created the topic: Plugin cbauthorprofile
Boa noite pessoal. O meu site na pagina inicial possui as introduções dos artigos e la em baixo um link "leia mais" para pessoa clicar e ir para a pagina do artigo completo.. isso todos conhecem.

Até ai tudo bem,
Eu instalei um plugin (cbauthorprofile) cria um box apos o conteudo do artigo com informações sobre o autor que criou o artigo.

O problema é: além de criar este box na pagina do artigo completo, ele tambem esta criando o mesmo box na pagina inicial apos as introduçoes causando uma confusao no Layout.

Queria saber se atraves deste codigo daria para mudar isso e obrigar o plugin a funcionar somente na pagina do artigo completo e nao na home do meu site. Se tiver alguem que manja de programaçao me ajuda por favor. obrigado

Code:
<?php
/**
* @version 1.0
* @package CBAuthorProfile
* @subpackage Content
* @Copyright (C) 2011 Tharanga Niroshana.
* @license GNU/GPL
* @author Created on 04-Jan-2011
*/

//-- No direct access
defined('_JEXEC') or die('=;)');


// Import library dependencies
jimport('joomla.plugin.plugin');


class plgContentCBAuthorProfile extends JPlugin
{



function plgContentCBAuthorProfile( &$subject, $params )
{
parent::__construct( $subject, $params );


}


function onPrepareContent( &$article, &$params, $limitstart )

{

}


function onAfterDisplayTitle( &$article, &$params, $limitstart )
{



$exclude_authors = explode(',',$pluginParams->get('exclude_authors',null));
foreach ($exclude_authors as $id) {
if ($article->created_by == (int)trim($id)) {
return;
}
}

$exclude_secs = explode(',',$pluginParams->get('exclude_secs',null));
foreach ($exclude_secs as $id) {
if ($article->sectionid == (int)trim($id)) {
return;
}
}

$exclude_cats = explode(',',$pluginParams->get('exclude_cats',null));
foreach ($exclude_cats as $id) {
if ($article->catid == (int)trim($id)) {
return;
}
}

}



function onAfterDisplayContent( &$row, &$article, $params)
{


$plugin = & JPluginHelper::getPlugin('content', 'cbauthorprofile');
$pluginParams = new JParameter( $plugin->params );


$showavatar = $pluginParams->get('showavatar');
$showname = $pluginParams->get('showname', 'name');
$textfloat = $pluginParams->get('textfloat');
$fontsize = $pluginParams->get('fontsize');
$textcolor = $pluginParams->get('textcolor');
$linkcolor = $pluginParams->get('linkcolor');
$textcolor = $pluginParams->get('textcolor');
$cbauthorweburl = $pluginParams->get('cbauthorweburl');
$cbauthordetails = $pluginParams->get('cbauthordetails');
$exclude_authors = explode(',',$pluginParams->get('exclude_authors',null));
foreach ($exclude_authors as $id) {
if ($row->created_by == (int)trim($id)) {
return;
}
}

$exclude_secs = explode(',',$pluginParams->get('exclude_secs',null));
foreach ($exclude_secs as $id) {
if ($row->sectionid == (int)trim($id)) {
return;
}
}

$exclude_cats = explode(',',$pluginParams->get('exclude_cats',null));
foreach ($exclude_cats as $id) {
if ($row->catid == (int)trim($id)) {
return;
}
}


$parameter = new JParameter($row->attribs);

global $mainframe;
$article_show_author = $parameter->get('show_author',null);
if($parameter->get('show_author') != '0' ){

$database = &JFactory::getDbo();
$uri = & JFactory::getURI();
$sql = "SELECT $showname from #__users where id = '$row->created_by' LIMIT 1";
$database->setQuery($sql);
$cbname = $database->loadResult();
$sql2 = "SELECT avatar FROM #__comprofiler WHERE user_id = '$row->created_by' AND avatarapproved = 1 LIMIT 1";
$database->setQuery($sql2);
$avatar = $database->loadResult();
$sql3 = "SELECT state FROM #__content WHERE id = '$row->id' LIMIT 1";
$database->setQuery($sql3);
$pubstate = $database->loadResult();

$sql5 = "SELECT $cbauthordetails FROM #__comprofiler WHERE user_id = '$row->created_by' LIMIT 1";
$database->setQuery($sql5);
$details = $database->loadResult();
$sql6 = "SELECT id from #__users where id = '$row->created_by'";
$database->setQuery($sql6);
$userid = $database->loadResult();
$sql7 = "SELECT * FROM #__content WHERE state = 1 AND created_by = ".$userid;
$database->setQuery($sql7);
$database->query();
$articles = $database->getNumRows();
$sql8 = "SELECT $cbauthorweburl FROM #__comprofiler WHERE user_id = '$row->created_by' LIMIT 1";
$database->setQuery($sql8);
$authorweburl = $database->loadResult();

$tn = 'tn';

if(($showfrontpage == 'no')) {
return; }

if ($authorweburl == "") {$authorweblink = "";}
else {$authorweblink = '&nbsp;-&nbsp;<a href="http://'.$authorweburl.'" target="blank">Website</a>';
}
$imagepath = "images/comprofiler/";
if($showavatar == 0) {$avatar = '';
}
if($showavatar == 1 AND $avatar == NULL) {
$avatar = "no_avatar.gif" AND $imagepath = "media/plg_cbauthorprofile/";
}

if($details == NULL) {
$details = 'This author has published '.$articles.' articles so far. More info about the author is coming soon.';
}
if(strstr($avatar,'gallery'))
{
$tn = '';
}

$createdbyauthor = $row->created_by_alias;
$createdby_id = $row->created_by;

return '<!-- CSS STYLES -->

<style type="text/css">
<!--

div.idcbauthorprofile {'. '
display: block;
padding: 3px;
font-size: 15px;
color: '.$textcolor.';
float: none;

}

div.idcbauthorprofile a {'. '
font-size: 15px;
color: '.$linkcolor.';
}

div.box {
border: 3px solid #CCCCCC;
color: #000000;
margin: 15px 15px 15px;
padding: 5px;

}

div.cbauthorprofile img {
border-style: none;
width: 90px;
height: 90px;
margin-top: 1px;
margin-right: 4px;
float: left;
}

--></style>'
. '<div class="box">' . '<div class="cbauthorprofile" style="display: inline-block"><a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id
. '"><img src="'. $imagepath . $tn . $avatar . '"></a><div class="idcbauthorprofile">' . '<a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id . '"> '. $cbname . '</a> '.$authorweblink.'<br>' . $details . '</div>'
. '</div></div>';
}
}

}

Please Entrar ou Registrar to join the conversation.