Node and Comments Form Settings module for Drupal seems to have a small bug in its code...
After installing it I got this ugly error.
After a few searches on google, I decided to dive into the code and see what is causing it.
On line 264 in commentformsettings.module there is a theme function which alters the comment form called phptemplate_box(). Inside it there is a call to commentformsettings_get_settings() which seem to return an empty value and the routine after this call doesn't handle this possibilty. A quick fix for this was to add an If statement before which checks if the result of the previous call is not empty. Below is the modified function code:
function phptemplate_box($title, $content, $region = 'main') {
$node = menu_get_object();
if(isset($node)) {
$settings = commentformsettings_get_settings($node->type);
if (!empty($settings)) {
if($title == "Post new comment" && $settings['cfs_pnc']['cfs_post_new_comment'] == 1 && isset($settings['cfs_pnc']['cfs_post_new_comment_value'])) {
$title = '';
}
if($title == "Post new comment" && $settings['cfs_pnc']['cfs_post_new_comment'] == 2 && isset($settings['cfs_pnc']['cfs_post_new_comment_value'])) {
$title = t($settings['cfs_pnc']['cfs_post_new_comment_value']);
}
if(isset($settings['cfs_pnc']['cfs_post_new_comment_tag'])) {
$output = '<'. $settings['cfs_pnc']['cfs_post_new_comment_tag'] .' class="title">'. $title .'</' . $settings['cfs_pnc']['cfs_post_new_comment_tag'] .'><div>'. $content .'</div>';
}
else {
$output = '<h2 class="title">'. $title .'</h2><div>'. $content .'</div>';
};
};
}
else {
// Default value
$output = '<h2 class="title">'. $title .'</h2><div>'. $content .'</div>';
}
return $output;
}
Until a module update or an "official" patch I think this is a viable solution...



Add new comment