Exemple #1
0
 }
 $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0;
 $redirect_to = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids'), nxt_get_referer());
 $redirect_to = add_query_arg('paged', $pagenum, $redirect_to);
 foreach ($comment_ids as $comment_id) {
     // Check the permissions on each
     if (!current_user_can('edit_comment', $comment_id)) {
         continue;
     }
     switch ($doaction) {
         case 'approve':
             nxt_set_comment_status($comment_id, 'approve');
             $approved++;
             break;
         case 'unapprove':
             nxt_set_comment_status($comment_id, 'hold');
             $unapproved++;
             break;
         case 'spam':
             nxt_spam_comment($comment_id);
             $spammed++;
             break;
         case 'unspam':
             nxt_unspam_comment($comment_id);
             $unspammed++;
             break;
         case 'trash':
             nxt_trash_comment($comment_id);
             $trashed++;
             break;
         case 'untrash':
Exemple #2
0
     die(__('ERROR: please type a comment.'));
 }
 $comment_parent = absint($_POST['comment_ID']);
 $comment_auto_approved = false;
 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
 $comment_id = nxt_new_comment($commentdata);
 $comment = get_comment($comment_id);
 if (!$comment) {
     die('1');
 }
 $position = isset($_POST['position']) && (int) $_POST['position'] ? (int) $_POST['position'] : '-1';
 // automatically approve parent comment
 if (!empty($_POST['approve_parent'])) {
     $parent = get_comment($comment_parent);
     if ($parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID) {
         if (nxt_set_comment_status($parent->comment_ID, 'approve')) {
             $comment_auto_approved = true;
         }
     }
 }
 ob_start();
 if ('dashboard' == $_REQUEST['mode']) {
     require_once ABSPATH . 'nxt-admin/includes/dashboard.php';
     _nxt_dashboard_recent_comments_row($comment);
 } else {
     if ('single' == $_REQUEST['mode']) {
         $nxt_list_table = _get_list_table('nxt_Post_Comments_List_Table');
     } else {
         $nxt_list_table = _get_list_table('nxt_Comments_List_Table');
     }
     $nxt_list_table->single_row($comment);
Exemple #3
0
/**
 * Removes a comment from the Spam
 *
 * @since 2.9.0
 * @uses do_action() on 'unspam_comment' before unspamming
 * @uses do_action() on 'unspammed_comment' after unspamming
 *
 * @param int $comment_id Comment ID.
 * @return mixed False on failure
 */
function nxt_unspam_comment($comment_id)
{
    if (!(int) $comment_id) {
        return false;
    }
    do_action('unspam_comment', $comment_id);
    $status = (string) get_comment_meta($comment_id, '_nxt_trash_meta_status', true);
    if (empty($status)) {
        $status = '0';
    }
    if (nxt_set_comment_status($comment_id, $status)) {
        delete_comment_meta($comment_id, '_nxt_trash_meta_status');
        do_action('unspammed_comment', $comment_id);
        return true;
    }
    return false;
}