function comment_approve in Drupal 7
Menu callback; publish specified comment.
Parameters
$cid: A comment identifier.
1 string reference to 'comment_approve'
- comment_menu in modules/
comment/ comment.module - Implements hook_menu().
File
- modules/
comment/ comment.pages.inc, line 111 - User page callbacks for the comment module.
Code
function comment_approve($cid) {
if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], "comment/{$cid}/approve")) {
return MENU_ACCESS_DENIED;
}
if ($comment = comment_load($cid)) {
$comment->status = COMMENT_PUBLISHED;
comment_save($comment);
drupal_set_message(t('Comment approved.'));
drupal_goto('node/' . $comment->nid);
}
return MENU_NOT_FOUND;
}