Personal tools
Views

User Handbook/Admin Panel/Content/Comments

From CMSMS

This page in: English - Deutsch - Français - Svenska - Русский - Norsk - Polski - Nederlands - Español - Lietuvių

Contents

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_news_comments" with the following content:

global $gCms;

$db = &$gCms->db;

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

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

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


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 Cration Mask' in 'Global Settings' (Site Admin Panel):

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>

This page in: English - Deutsch - Français - Svenska - Русский - Norsk - Polski - Nederlands - Español - Lietuvių