Comments Link Showing Up in Blog Descriptions

vde 24 Nov, 2008
Hello, and thanks very much for your great work. We are planning on purchasing the license next week.
I am having a bug where the comments link is showing up where it shouldn't. I have enabled the option to show comments in blog display, and in the section where I have chosen to show comments it is working perfectly (see http://democraticegypt.org/index.php?option=com_content&view=category&layout=blog&id=48&Itemid=65).

Unfortunately, the link to add a new comment is also showing up on all pages in my website that are blog display with a description showing. See, for example, http://democraticegypt.org/index.php?option=com_content&view=category&layout=blog&id=46&Itemid=61.

I see that there are some other posts about comments link showing up where it should not, but this appears to be something different. Basically it is showing up on any blog view page where the description is set to "show". Any advice or help you can offer would be greatly appreciated.

Thank you!
vde 24 Nov, 2008
Hi Max,

Thank you for your response. I checked the page you sent me to, but my ChronoComments.php does not have

if((JRequest::getVar('option') == 'com_newsfeeds')||(JRequest::getVar('option') == 'com_contact'))return;


You said that if you don't have it, to just add the line after
global $mainframe, $addChronoCommentscripts;


but I do not have that line either!

I am not sure why my ChronoComments.php is so different? Here are the first ten lines of the file for your reference.
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

$mainframe->registerEvent( 'onPrepareContent', 'plgContentChronocomments' );
require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();


function plgContentChronocomments( &$row, &$params, $page=0 )
{
	global $mainframe;
	JPlugin::loadLanguage( 'com_chronocomments' );
	$uri = & JFactory::getURI();
	$configs = JComponentHelper::getParams('com_chronocomments');
	if((JRequest::getVar('print') == '1')&&($configs->get('disable_onprint') == '1'))return;
	$user = JFactory::getUser();
	$session =& JFactory::getSession();
	// first captcha
	if($configs->get('captcha') == '1'){		
		$alphanum  = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789abcdefghijkmnpqrstuvwxyz";
		$rand = substr(str_shuffle($alphanum), 0, 5);
		$session->set("comment_captcha", md5(strtolower($rand)), md5('chrono'));
		$session->set("comment_captcha_orig", $rand, md5('chrono'));
	}
	//pagination


Thanks in advance for all of your help!
Max_admin 24 Nov, 2008
ok, just after
global $mainframe;
in your file.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
vde 24 Nov, 2008
Unfortunately, still no luck. After
global $mainframe;
I inserted
if(!($id || $catid || $sectionid))return;
but what this did was to remove the "Comments" link from both the places I do not want it *and* the places I do want it. Then I replaced
if(!($id || $catid || $sectionid))return;
with
if(JRequest::getVar('view') == 'category')return;
but it did the same thing -- removed "Comments" link from everywhere.

If you take a look at http://democraticegypt.org/index.php?option=com_content&view=category&layout=blog&id=48&Itemid=65 you will see that it says "Read 0 Comments" under all three blog posts. But when I tried the two different codes you told me, it removed those three links. What I am looking for is a way to keep those three links but at the same time to remove the links which are incorrectly showing up in the "description" headings of other blog layout pages (like the top of http://democraticegypt.org/index.php?option=com_content&view=category&layout=blog&id=46&Itemid=61.

Sorry for the trouble! But I do appreciate the help. Let me know if you have another idea?
vde 25 Nov, 2008
SUCCESS!! Thank you. All for that one little piece of code.
For anyone suffering the same problem I was suffering, simply insert
if(!$row->id)return;
after
global $mainframe;
Max_admin 25 Nov, 2008
Thanks for replying back with the correct solution!

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger