People want to stop people adding comments to previews without reading the full entry: http://drupal.org/node/21538
Here is my quick solution for my site.
In function comment_configure() add:
$form['viewing_options']['comment_no_add_with_readmore'] = array(
'#type' => 'checkbox',
'#title' => t('Suppress comments with readmore'),
'#default_value' => variable_get('comment_no_add_with_readmore', false),
'#description' => t('Stop people from adding comments when they have read only the teaser.'
. ' If "read more" is present then remove the option to add comments.'),
);
In comment_link() add:
/* PeterMoulding.com 20060403
Add the option to suppress comments if there is more to read.
*/
$comment_no_add_with_readmore = false;
if(variable_get('comment_no_add_with_readmore', false) == 1)
{
$comment_no_add_with_readmore = true;
}
Replace:
$links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Add a new comment to this page.')), NULL, 'comment_form');
with:
/* Copyright PeterMoulding.com 20060403
Make function readable
$links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Add a new comment to this page.')), NULL, 'comment_form');
Add the option to suppress comments if there is more to read.
*/
if(!$comment_no_add_with_readmore or !$node->readmore)
{
$links[] = l(t('add new comment'), 'comment/reply/' . $node->nid,
array('title' => t('Add a new comment to this page.')),
NULL, 'comment_form');
}
Comments
Comment #1
Egon Bianchet commentedPlease submit a patch (howto create patches)
Comment #2
peterx commentedHere is the diff created by jdiff in jedit. There are lots of changes because I improve the formatting before changing the code.
Comment #3
peterx commentedThe patch file did not look right so I used Cygwin diff.
Comment #4
Egon Bianchet commentedComment #5
dmitrig01 commentedIt needs to be open source