Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.369 diff -u -r1.369 comment.module --- modules/comment.module 7 Sep 2005 20:45:53 -0000 1.369 +++ modules/comment.module 12 Sep 2005 17:06:57 -0000 @@ -435,6 +435,9 @@ function comment_validate($edit) { global $user; + // Invoke other validation handlers + module_invoke_all('comment', 'validate', $edit); + // only admins can change these fields if (!user_access('administer comments')) { $edit['uid'] = $user->uid; @@ -1412,6 +1415,9 @@ $form .= form_textfield(t('E-mail'), 'mail', $edit['mail'], 30, 64, t('The content of this field is kept private and will not be shown publicly.'), NULL, TRUE); $form .= form_textfield(t('Homepage'), 'homepage', $edit['homepage'], 30, 255); } + + // Prepend extra form additions + $form .= implode('', module_invoke_all('comment', 'form pre', $edit)); if (variable_get('comment_subject_field', 1)) { $form .= form_textfield(t('Subject'), 'subject', $edit['subject'], 60, 64); @@ -1419,6 +1425,9 @@ $form .= form_textarea(t('Comment'), 'comment', $edit['comment'] ? $edit['comment'] : $user->signature, 60, 15, '', NULL, TRUE); + // Append extra form additions + $form .= implode('', module_invoke_all('comment', 'form post', $edit)); + $form .= filter_form('format', $edit['format']); $form .= form_hidden('cid', $edit['cid']); $form .= form_hidden('pid', $edit['pid']); @@ -1434,8 +1443,17 @@ $form .= form_submit(t('Post comment')); } - $destination = $_REQUEST['destination'] ? 'destination='. $_REQUEST['destination'] : ''; - return theme('box', $title, form($form, 'post', url('comment/reply/'. $edit['nid'], $destination))); + $attributes = array(); + $attributes[] = array('id' => 'comment-form'); + if ($_REQUEST['destination']) { + $attributes[] = array('destination' => $_REQUEST['destination']); + } + $extra = module_invoke_all('comment', 'form param', $edit); + if (is_array($extra)) { + $attributes = array_merge($extra, $attributes); + } + + return theme('box', $title, form($form, 'post', url('comment/reply/'. $edit['nid'], $attributes))); } function theme_comment_preview($comment, $links = '', $visible = 1) { @@ -1458,6 +1476,10 @@ // Switch to folded/unfolded view of the comment if ($visible) { $comment->comment = check_markup($comment->comment, $comment->format, FALSE); + + // Comment API hook + $comment->comment .= implode('', module_invoke_all('comment', 'view', $comment)); + $output .= theme('comment', $comment, $links); } else {