back to Modules


Important: This module has no active Developer anymore!

You better use the CGFeedback module!

Comments module

Note: The tips on this page require at least the 1.7 version of the [Comments module].

You can get the latest SVN version of Comments from [Comments SVN]

Comments on News Articles

Add this to your News Detail Template:

{cms_module module='comments' modulename='News' pageid=$entry->id}


Use TinyMCE with comments

Idea from this post: TinyMCE 2.0.2 1. Install the TinyMCE module 2. Insert the following code into your comments template:

{literal}
<script language="javascript" type="text/javascript" src="modules/TinyMCE/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">

tinyMCE.init({
mode : "textareas",
theme : "advanced",
       plugins : "zoom,advlink,emotions,iespell,style,advhr,contextmenu,advimage",
theme_advanced_buttons1 : "bold,italic,underline,link,unlink,forecolor,emotions",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left" });

</script>
{/literal}

How to get smilies to work (quoting Mark): " I had to hack the tiny basic to get smileys to work...

Line 71...

         $plugins="cmsmslink,fullscreen,advimage,simplebrowser,emotions";
         if ($tiny->GetPreference("allow_tables","0")=="1") {
           $plugins.=",table";
         }

"

Show count of comments in news summary

Make a new User Defined Tag called "count_comments" with the following content:

if(!isset(params['theid'])){
    die("Param: theid is required!");
}

global $gCms;

$db = &$gCms->db;

// Get number of comments
$q = "SELECT * FROM ".cms_db_prefix()."module_comments 
WHERE page_id = ? AND module_name='News' AND active='1'"; // or 'Uploads' or whatever instead of 'News'
$dbresult = $db->Execute( $q, array($params['theid']) );
if( !$dbresult )
{
    echo 'DB error: '. $db->ErrorMsg()."<br/>";
}
else {
    $num_rows = $dbresult->RecordCount();
   ($num_rows == 1 ? $sing_plur = "comment" : $sing_plur = "comments");
    echo $num_rows." ".$sing_plur;
}

is this faster????

if(!isset(params['theid'])){
    die("Param: theid is required!");
}

global $gCms;

$db = &$gCms->db;

// Get number of comments
$q = "SELECT COUNT(comment_id) AS numrows FROM ".cms_db_prefix()."module_comments 
WHERE page_id = ? AND module_name='News' AND active='1'"; // or 'Uploads' or whatever instead of 'News'
$dbresult = $db->Execute( $q, array($params['theid']) );
if( !$dbresult )
{
    echo 'DB error: '. $db->ErrorMsg()."<br/>";
}
else
{
    $num_rows_res = $dbresult->FetchRow();
    $num_rows = $num_rows_res['numrows'];
    ($num_rows == 1 ? $sing_plur = "comment" : $sing_plur = "comments");
    echo $num_rows." ".$sing_plur;
}

Then put this in your News Summary Template (inside the foreach tag):

<a href="{$entry->link}">{count_comments theid=$entry->id}</a>

For Upload Module use this:

{count_comments theid=$entry->id}


Fix 'Unable to save captcha-image.' error

chmod 777 modules/Comments/b2evo_captcha/b2evo_captcha_tmp

Fix 'captcha-image do not display' error

If your captcha-images do not display because of wrong permission (eg. 640) you may have to change the "File Creation Mask (umask)" in "Site Admin/Global Settings" from the Admin Console.

The 'File Creation Mask (umask)' can cause some files to be unreadable. If in doubt, set it back to the default: 022

You may have to change File Creation Mask (umask): from "022" to "002" to keep from getting 403 forbidden errors when trying to view generated thumbnails on your webhost.

Template for when Captcha is used with MathCaptcha library

See Patch Simple Math Captcha Library Attached

<div id="comments">
<!-- Start Comments Display Template -->
{if FALSE == $errormessage}
{startExpandCollapse id="name" title="$addacomment"}
{else}
{$errormessage}
{/if}
<h3>{$addacomment}</h3>

{$startform}

<table>
{if $spamprotect}
<tr><td colspan="2">Add the following numbers prove you are human (spam prevention measure):</p></td></tr>
	<tr>
<td>
{$image}
{$spamprotectimage}</td>

		<td>{$inputentercode}</td>
	</tr>
{/if}

	<tr>
		<td>{$yournametxt}(*):</td>
		<td>{$inputyourname}</td>
	</tr>
{if $emailfield}
	<tr>
		<td>{$emailtxt}:</td>
		<td>{$inputemail}</td>
	</tr>
{/if}
{if $websitefield}
	<tr>
		<td>{$websitetxt}:</td>
		<td>{$inputwebsite}</td>
	</tr>
{/if}
	<tr>
		<td>{$commenttxt}(*):</td>
		<td>{$inputcomment}</td>
	</tr>
	<tr>
		<td> </td>
		<td>{$submit} {$cancel}</td>
	</tr>
</table>

{$endform}
{if FALSE == $errormessage}
{stopExpandCollapse} 
{/if}
<ul>
{foreach from=$items item=entry}
<li>
{$entry->date} - 
		{if $entry->author_email}
		<a href="mailto:{$entry->author_email|escape:"hexentity"}">{$entry->comment_author}</a>
		{else}
		{$entry->comment_author}
		{/if}
		{if $entry->author_website}(<a href="{$entry->author_website}" target="_blank">{$entry->author_website}</a>){/if}
	{$entry->comment_data}
</li>
{/foreach}
</ul>
<!-- End Comments Display Template -->
</div>


back to Modules


This page in: English - Deutsch - Español - Français - Italiano - Lietuvių - Nederlands - Norsk - Polski - Česky - Русский - Svenska - Tiếng Việt - عربي - 日本語 简体中文

User Handbook/Admin Panel/Content/Comments

From CMSMS

A2 Hosting