Skip navigation
Help

comment_approve

7 comment.pages.inc comment_approve($cid)

Menu callback; publish specified comment.

Parameters

$cid: A comment identifier.

1 string reference to 'comment_approve'

File

drupal/modules/comment/comment.pages.inc, line 107
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;
}