function comment_approve

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.