diff --git a/wp-admin/comment.php b/wp-admin/comment.php index 38e714f045..a883e613ed 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -258,23 +258,23 @@ case 'unapprovecomment' : switch ( $action ) { case 'deletecomment' : - wp_delete_comment( $comment_id ); + wp_delete_comment( $comment ); $redir = add_query_arg( array('deleted' => '1'), $redir ); break; case 'trashcomment' : - wp_trash_comment($comment_id); + wp_trash_comment( $comment ); $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir ); break; case 'untrashcomment' : - wp_untrash_comment($comment_id); + wp_untrash_comment( $comment ); $redir = add_query_arg( array('untrashed' => '1'), $redir ); break; case 'spamcomment' : - wp_spam_comment($comment_id); + wp_spam_comment( $comment ); $redir = add_query_arg( array('spammed' => '1', 'ids' => $comment_id), $redir ); break; case 'unspamcomment' : - wp_unspam_comment($comment_id); + wp_unspam_comment( $comment ); $redir = add_query_arg( array('unspammed' => '1'), $redir ); break; case 'approvecomment' : diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 771a109c32..fbbd402628 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -526,25 +526,25 @@ function wp_ajax_delete_comment() { if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) { if ( 'trash' == $status ) wp_die( time() ); - $r = wp_trash_comment( $comment->comment_ID ); + $r = wp_trash_comment( $comment ); } elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) { if ( 'trash' != $status ) wp_die( time() ); - $r = wp_untrash_comment( $comment->comment_ID ); + $r = wp_untrash_comment( $comment ); if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) // undo trash, not in trash $delta = 1; } elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) { if ( 'spam' == $status ) wp_die( time() ); - $r = wp_spam_comment( $comment->comment_ID ); + $r = wp_spam_comment( $comment ); } elseif ( isset($_POST['unspam']) && 1 == $_POST['unspam'] ) { if ( 'spam' != $status ) wp_die( time() ); - $r = wp_unspam_comment( $comment->comment_ID ); + $r = wp_unspam_comment( $comment ); if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) // undo spam, not in spam $delta = 1; } elseif ( isset($_POST['delete']) && 1 == $_POST['delete'] ) { - $r = wp_delete_comment( $comment->comment_ID ); + $r = wp_delete_comment( $comment ); } else { wp_die( -1 ); } diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 2a32299aec..c71673579f 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -1164,13 +1164,10 @@ function wp_spam_comment( $comment_id ) { * * @since 2.9.0 * - * @param int $comment_id Comment ID. + * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. * @return bool True on success, false on failure. */ -function wp_unspam_comment($comment_id) { - if ( ! (int)$comment_id ) - return false; - +function wp_unspam_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; @@ -1183,15 +1180,15 @@ function wp_unspam_comment($comment_id) { * * @param int $comment_id The comment ID. */ - do_action( 'unspam_comment', $comment_id ); + do_action( 'unspam_comment', $comment->comment_ID ); - $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true); + $status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ); if ( empty($status) ) $status = '0'; if ( wp_set_comment_status( $comment, $status ) ) { - delete_comment_meta( $comment_id, '_wp_trash_meta_status' ); - delete_comment_meta( $comment_id, '_wp_trash_meta_time' ); + delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' ); + delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' ); /** * Fires immediately after a comment is unmarked as Spam. * @@ -1199,7 +1196,7 @@ function wp_unspam_comment($comment_id) { * * @param int $comment_id The comment ID. */ - do_action( 'unspammed_comment', $comment_id ); + do_action( 'unspammed_comment', $comment->comment_ID ); return true; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 45c7aeb22d..1532310ca8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34129'; +$wp_version = '4.4-alpha-34130'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.