Hey Gang,
We're using ChronoComments for a church client and when a user clicks on a comment link on the frontpage, we're using the Latest Comments module there, it will direct them to the comments list but does not render the modules for the page the comments are on. You can check this out at http://thedaybreakchurch.com and scroll to the 'Prayer Center' (yes, we're using ChronoComments as a way for people to submit prayer requests! It's great and ChronoComments has been working excellent for this!) If you click the top one, you get directed to this link: http://thedaybreakchurch.com/component/content/article/134#commentID24 which displays that page of comments, but no modules..
Is there a way to 1) either change where the module is directing the user? Like to the Article page that the comments are below (http://thedaybreakchurch.com/resources/prayer-center, so the modules will load. Or 2) a way to have the Component call modules that are needed - like login, etc.??
Thank you! And great work on the component Max and the rest of the ChronoEngine team!
J
We're using ChronoComments for a church client and when a user clicks on a comment link on the frontpage, we're using the Latest Comments module there, it will direct them to the comments list but does not render the modules for the page the comments are on. You can check this out at http://thedaybreakchurch.com and scroll to the 'Prayer Center' (yes, we're using ChronoComments as a way for people to submit prayer requests! It's great and ChronoComments has been working excellent for this!) If you click the top one, you get directed to this link: http://thedaybreakchurch.com/component/content/article/134#commentID24 which displays that page of comments, but no modules..
Is there a way to 1) either change where the module is directing the user? Like to the Article page that the comments are below (http://thedaybreakchurch.com/resources/prayer-center, so the modules will load. Or 2) a way to have the Component call modules that are needed - like login, etc.??
Thank you! And great work on the component Max and the rest of the ChronoEngine team!
J
Hi reveive,
I'm not to familiar with ChronoComments but I tool a quick peek and this looks to me like an SEF problem. There seems to be chunk of the url missing - maybe CC never generates it or the SEF chops it off again.
Bob
I'm not to familiar with ChronoComments but I tool a quick peek and this looks to me like an SEF problem. There seems to be chunk of the url missing - maybe CC never generates it or the SEF chops it off again.
Bob
Jessey, is this ChronoComments V1.2 ? do you have sh404sef running ?
How did you install V1.2 ? this was a new install or an upgrade ?
Strange, this issue is completely solved in V1.2 and you should have a SEF link to the article, whats the article SEF link generated by Joomla ?
I have no idea, nobody complained from this issue at all after the V1.2, the plugin should generate the same URL as the one you have pasted above, does this problem happen at all pages ?
I only have the comment piece working on this one page, as it is use specific, not article related. What about a hack to the plugin PHP to generate this url??
Is it the plugin or the module that creates the link path for the module ??
Here are my plugins/ChronoComments.php and modules/helper.php for you to look at (attached as zip), if needed.
J
Is it the plugin or the module that creates the link path for the module ??
Here are my plugins/ChronoComments.php and modules/helper.php for you to look at (attached as zip), if needed.
J
Hi revive,
the plugin file only will generate the clean Joomla link which will be added at the bottom of the article in the blog page like "Read 9 comments>>", I looked at your file and they are the uptodate ones! so any link at your blog pages says "Read n comments>>" should work fine!
Regards
Max
the plugin file only will generate the clean Joomla link which will be added at the bottom of the article in the blog page like "Read 9 comments>>", I looked at your file and they are the uptodate ones! so any link at your blog pages says "Read n comments>>" should work fine!
Regards
Max
Hey Max,
You lost me...๐ So, the plugin is what produces the links for the Latest Comments module, correct? Then, in this case, with the plugin creating links like this: <domain>/component/content/article/134#commentID21 instead of <domain>/parent-menu-item/sub-menu-item#commentID21 ... what should I do? I would like the module to direct the users to the actual joomla page that the comments are on, so they can view the modules,.. the login module, which is needed for them to post comments doesn't show when they follow the links from the module... how can I fix this??
It seems that I should be able to change this link path within the Module's 'helper.php' file at this line:
Or the line just after it..
Or placing an absolute url on this line in the plugins/content/ChronoComments.php file here:
Is that correct? Or do I need to edit the link creation within the plugin??
Thanks
J
You lost me...๐ So, the plugin is what produces the links for the Latest Comments module, correct? Then, in this case, with the plugin creating links like this: <domain>/component/content/article/134#commentID21 instead of <domain>/parent-menu-item/sub-menu-item#commentID21 ... what should I do? I would like the module to direct the users to the actual joomla page that the comments are on, so they can view the modules,.. the login module, which is needed for them to post comments doesn't show when they follow the links from the module... how can I fix this??
It seems that I should be able to change this link path within the Module's 'helper.php' file at this line:
$page_link = JRoute::_(JURI::Base().'PLACING_ABSOLUTE_URL_HERE#commentID'.$row->id);
Or the line just after it..
$current_comment_item = $params->get( 'body', '<strong>{name}:</strong><a href="{page_link}#commentID{id}">{text}</a><br>' );
Or placing an absolute url on this line in the plugins/content/ChronoComments.php file here:
$page_link = JRoute::_(JURI::Base().'PLACING_ABSOLUTE_URL_HERE#commentID'.$row->id);
Is that correct? Or do I need to edit the link creation within the plugin??
Thanks
J
Hi Jesse,
No, the plugin doesn't produce any thing for the module, this problem has been fixed in V1.2 of the module, do you have the module V1.2 ?
Cheers
Max
No, the plugin doesn't produce any thing for the module, this problem has been fixed in V1.2 of the module, do you have the module V1.2 ?
Cheers
Max
Yes, I have the new version of the Component, Module and Plugin..
AAHHHHH... I'm loosing it LOL๐
What now?
J
AAHHHHH... I'm loosing it LOL๐
What now?
J
Hi Jesse,
I have no idea, show me the helper.php file yours!
Max
I have no idea, show me the helper.php file yours!
Max
Hey Max,
Here is the helper.php file code I have:
[code]<?php
defined('_JEXEC') or die('Restricted access');
require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
class modChronocommentsHelper {
function getComments(&$params) {
global $mainframe;
$database =& JFactory::getDBO();
$extra = "";
if($params->get( 'limitsections', '' ))$extra .= " AND b.sectionid IN (".$params->get( 'limitsections', '' ).")";
if($params->get( 'limitcategories', '' ))$extra .= " AND b.catid IN (".$params->get( 'limitcategories', '' ).")";
// changed .$params->get( 'order', 'ASC' ). to: .$params->get( 'order', 'DESC' ). to allow for a descending view of the most recent comments via the module
$query = "SELECT a.*, b.title AS articletitle FROM #__chrono_comments AS a, #__content AS b WHERE a.pageid = b.id AND a.published='1' AND a.verify='1'".$extra." ORDER BY a.datetime ".$params->get( 'order', 'DESC' )." LIMIT 0,".$params->get( 'commentscount', 5 );
$database->setQuery( $query );
$comments = $database->loadObjectList();
$configs = JComponentHelper::getParams('com_chronocomments');
//$current_comment_item = $params->get( 'body', '{name}:{text}<br>' );
$all_comments = '';
foreach($comments as $commentx){
//check cb connection
$avatar = '';
if($configs->get('cbconnection') == '1'){
if (!JComponentHelper::isEnabled('com_comprofiler', true)){
JError::raiseWarning('SOME_ERROR', JText::_('You need to have Community builder installed if you enabled the community builder connection.'));
}else{
if($commentx->userid){
$query = "SELECT avatar FROM #__comprofiler WHERE user_id = '".$commentx->userid."'";
$database->setQuery( $query );
$avatar = $database->loadResult();
if($avatar && file_exists(JPATH_BASE.DS.'images'.DS.'comprofiler'.DS.$avatar)){
$avatar = JURI::Base().'images/comprofiler/'.$avatar;
}
}
}
}
//end cb connection
//get full article link
$query = 'SELECT a.*,' .
' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'.
' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'.
' FROM #__content AS a' .
' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' .
' INNER JOIN #__categories AS cc ON cc.id = a.catid' .
' INNER JOIN #__sections AS s ON s.id = a.sectionid' .
' WHERE a.id='.$commentx->pageid;
$database->setQuery( $query );
$article = $database->loadObject();
$page_link = JRoute::_(JURI::Base().'resources/prayer-center#commentID'.$row->id);
//end article link
$current_comment_item = $params->get( 'body', '<strong>{name}:</strong><a href="{page_link}#commentID{id}">{text}</a><br>' );
$comment_elements = array(
'id' => $commentx->id,
'name' => modChronocommentsHelper::censor($commentx->name),
'email' => $commentx->email,
'url' => $commentx->url,
'text' => $params->get( 'limittext', 0 ) ? substr(modChronocommentsHelper::censor(modChronocommentsHelper::bb2html(modChronocommentsHelper::cleanBB($commentx->text))), 0, $params->get( 'limittext', 0 )) : modChronocommentsHelper::censor(modChronocommentsHelper::bb2html(modChronocommentsHelper::cleanBB($commentx->text))),
'datetime' => strftime(JText::_( 'DATETIMEFORMAT' ),strtotime($commentx->datetime)),
'rating' => $commentx->rating,
'pageid' => $commentx->pageid,
'component' => $commentx->component,
'parentid' => $commentx->parentid,
'title' => $commentx->articletitle,
'page_link' => $page_link,
'avatar' => $avatar ? $avatar : JURI::Base().'components/com_chronocomments/images/avatar1.png',
'userid' => $commentx->userid
);
foreach($comment_elements as $comment_element_name => $comment_element_value){
$current_comment_item = preg_replace("/\\{".$comment_element_name."\\}/", $comment_element_value, $current_comment_item);
}
$all_comments .= $current_comment_item;
}
$result = $params->get( 'header', '' ).$all_comments.$params->get( 'footer', '' );
return $result;
}
function bb2html($text){
global $mainframe;
$configs = JComponentHelper::getParams('com_chronocomments');
if($configs->get('bbcode') == '1'){
$bbcode = array(
"/\[i\](.*?)\[\/i\]/is",
"/\[b\](.*?)\[\/b\]/is",
"/\[u\](.*?)\[\/u\]/is",
/*"/\[img\](.*?)\[\/img\]/is",*/
"/\[url=(.*?)\](.*?)\[\/url\]/is",
"/\[url\](.*?)\[\/url\]/is",
"/\[size=(.*?)\](.*?)\[\/size\]/is",
'/\[code\](.*?)\[\/code\]/is',
'/\[quote\](.*?)\[\/quote\]/is',
"/\[list\](.*?)\[\/list\]/is",
"/\[li\](.*?)\[\/li\]/is"
);
$htmlcode = array(
"<i>$1</i>",
"<b>$1</b>",
"<u>$1</u>",
/*"<img src=\"$1\" />",*/
"<a href=\"$1\" rel=\"nofollow\" target=\"_blank\">$2</a>",
"<a href=\"$1\" rel=\"nofollow\" target=\"_blank\">$1</a>",
'<font size=$1>$2</font>',
'<code>$1</code>',
'<p style="font-weight: bold; padding: 0px; margin: 0px;">Quote:</p><blockquote style="padding: 0px; margin: 0px;">$1</blockquote>',
'<ul>$1</ul>',
'<li>$1</li>'
);
$newtext = preg_replace($bbcode, $htmlcode, $text);
$newtext = nl2br($newtext);
return $newtext;
}else{
$newtext = nl2br($text);
return $newtext;
}
}
function censor($text){
global $mainframe;
$newtext = $text;
$configs = JComponentHelper::getParams('com_chronocomments');
if(($configs->get('enablecensor') == '1')&&($configs->get('censorlist'))){
$censors = explode("\n", $configs->get('censorlist'));
foreach($censors as $censor){
$newtext = str_replace($censor, $configs->get('censor_replace'), $newtext);
}
return $newtext;
}else{
return $newtext;
}
}
function cleanBB($text){
$bbcode = array(
"[list]", "", " ", "[/list]",
"
",
"", "",
"", "",
"", "",
'[color="', "[/color]",
"[size=\"", "[/size]",
'[url="', "[/url]",
"[mail=\"", "[/mail]",
"
"
global $mainframe;
$newtext = $text;
$newtext = str_replace($bbcode, '', $newtext);
return $newtext;
}
}
[/code]
Here is the helper.php file code I have:
[code]<?php
defined('_JEXEC') or die('Restricted access');
require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
class modChronocommentsHelper {
function getComments(&$params) {
global $mainframe;
$database =& JFactory::getDBO();
$extra = "";
if($params->get( 'limitsections', '' ))$extra .= " AND b.sectionid IN (".$params->get( 'limitsections', '' ).")";
if($params->get( 'limitcategories', '' ))$extra .= " AND b.catid IN (".$params->get( 'limitcategories', '' ).")";
// changed .$params->get( 'order', 'ASC' ). to: .$params->get( 'order', 'DESC' ). to allow for a descending view of the most recent comments via the module
$query = "SELECT a.*, b.title AS articletitle FROM #__chrono_comments AS a, #__content AS b WHERE a.pageid = b.id AND a.published='1' AND a.verify='1'".$extra." ORDER BY a.datetime ".$params->get( 'order', 'DESC' )." LIMIT 0,".$params->get( 'commentscount', 5 );
$database->setQuery( $query );
$comments = $database->loadObjectList();
$configs = JComponentHelper::getParams('com_chronocomments');
//$current_comment_item = $params->get( 'body', '{name}:{text}<br>' );
$all_comments = '';
foreach($comments as $commentx){
//check cb connection
$avatar = '';
if($configs->get('cbconnection') == '1'){
if (!JComponentHelper::isEnabled('com_comprofiler', true)){
JError::raiseWarning('SOME_ERROR', JText::_('You need to have Community builder installed if you enabled the community builder connection.'));
}else{
if($commentx->userid){
$query = "SELECT avatar FROM #__comprofiler WHERE user_id = '".$commentx->userid."'";
$database->setQuery( $query );
$avatar = $database->loadResult();
if($avatar && file_exists(JPATH_BASE.DS.'images'.DS.'comprofiler'.DS.$avatar)){
$avatar = JURI::Base().'images/comprofiler/'.$avatar;
}
}
}
}
//end cb connection
//get full article link
$query = 'SELECT a.*,' .
' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'.
' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'.
' FROM #__content AS a' .
' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' .
' INNER JOIN #__categories AS cc ON cc.id = a.catid' .
' INNER JOIN #__sections AS s ON s.id = a.sectionid' .
' WHERE a.id='.$commentx->pageid;
$database->setQuery( $query );
$article = $database->loadObject();
$page_link = JRoute::_(JURI::Base().'resources/prayer-center#commentID'.$row->id);
//end article link
$current_comment_item = $params->get( 'body', '<strong>{name}:</strong><a href="{page_link}#commentID{id}">{text}</a><br>' );
$comment_elements = array(
'id' => $commentx->id,
'name' => modChronocommentsHelper::censor($commentx->name),
'email' => $commentx->email,
'url' => $commentx->url,
'text' => $params->get( 'limittext', 0 ) ? substr(modChronocommentsHelper::censor(modChronocommentsHelper::bb2html(modChronocommentsHelper::cleanBB($commentx->text))), 0, $params->get( 'limittext', 0 )) : modChronocommentsHelper::censor(modChronocommentsHelper::bb2html(modChronocommentsHelper::cleanBB($commentx->text))),
'datetime' => strftime(JText::_( 'DATETIMEFORMAT' ),strtotime($commentx->datetime)),
'rating' => $commentx->rating,
'pageid' => $commentx->pageid,
'component' => $commentx->component,
'parentid' => $commentx->parentid,
'title' => $commentx->articletitle,
'page_link' => $page_link,
'avatar' => $avatar ? $avatar : JURI::Base().'components/com_chronocomments/images/avatar1.png',
'userid' => $commentx->userid
);
foreach($comment_elements as $comment_element_name => $comment_element_value){
$current_comment_item = preg_replace("/\\{".$comment_element_name."\\}/", $comment_element_value, $current_comment_item);
}
$all_comments .= $current_comment_item;
}
$result = $params->get( 'header', '' ).$all_comments.$params->get( 'footer', '' );
return $result;
}
function bb2html($text){
global $mainframe;
$configs = JComponentHelper::getParams('com_chronocomments');
if($configs->get('bbcode') == '1'){
$bbcode = array(
"/\[i\](.*?)\[\/i\]/is",
"/\[b\](.*?)\[\/b\]/is",
"/\[u\](.*?)\[\/u\]/is",
/*"/\[img\](.*?)\[\/img\]/is",*/
"/\[url=(.*?)\](.*?)\[\/url\]/is",
"/\[url\](.*?)\[\/url\]/is",
"/\[size=(.*?)\](.*?)\[\/size\]/is",
'/\[code\](.*?)\[\/code\]/is',
'/\[quote\](.*?)\[\/quote\]/is',
"/\[list\](.*?)\[\/list\]/is",
"/\[li\](.*?)\[\/li\]/is"
);
$htmlcode = array(
"<i>$1</i>",
"<b>$1</b>",
"<u>$1</u>",
/*"<img src=\"$1\" />",*/
"<a href=\"$1\" rel=\"nofollow\" target=\"_blank\">$2</a>",
"<a href=\"$1\" rel=\"nofollow\" target=\"_blank\">$1</a>",
'<font size=$1>$2</font>',
'<code>$1</code>',
'<p style="font-weight: bold; padding: 0px; margin: 0px;">Quote:</p><blockquote style="padding: 0px; margin: 0px;">$1</blockquote>',
'<ul>$1</ul>',
'<li>$1</li>'
);
$newtext = preg_replace($bbcode, $htmlcode, $text);
$newtext = nl2br($newtext);
return $newtext;
}else{
$newtext = nl2br($text);
return $newtext;
}
}
function censor($text){
global $mainframe;
$newtext = $text;
$configs = JComponentHelper::getParams('com_chronocomments');
if(($configs->get('enablecensor') == '1')&&($configs->get('censorlist'))){
$censors = explode("\n", $configs->get('censorlist'));
foreach($censors as $censor){
$newtext = str_replace($censor, $configs->get('censor_replace'), $newtext);
}
return $newtext;
}else{
return $newtext;
}
}
function cleanBB($text){
$bbcode = array(
"[list]", "
"
"", "",
"", "",
"", "",
'[color="', "[/color]",
"[size=\"", "[/size]",
'[url="', "[/url]",
"[mail=\"", "[/mail]",
"
", "
","
", "
");global $mainframe;
$newtext = $text;
$newtext = str_replace($bbcode, '', $newtext);
return $newtext;
}
}
[/code]
Good, what do you have in the body box at the module config ?
Hey Max,
AAHHHH!!! That was it! I had no idea that there was a url string specified within the module itself.. I have been searching all the php files!!! LOL. Fixed. Easy fix.. just didn't know where to look. Thank you!!
Is it possible this was left over from the v1.0 when we upgraded to the v1.2?
Thanks Max!
j
AAHHHH!!! That was it! I had no idea that there was a url string specified within the module itself.. I have been searching all the php files!!! LOL. Fixed. Easy fix.. just didn't know where to look. Thank you!!
Is it possible this was left over from the v1.0 when we upgraded to the v1.2?
Thanks Max!
j
Hi Jesse,
yes, this was left from V1.0 for sure!
Regards,
Max
yes, this was left from V1.0 for sure!
Regards,
Max
This topic is locked and no more replies can be posted.