Use get_post() in lieu of direct query in wp_ajax_replyto_comment(). fixes #23940.
git-svn-id: https://develop.svn.wordpress.org/trunk@23907 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cb4b384500
commit
c9deeed6e9
|
@ -724,14 +724,16 @@ function wp_ajax_replyto_comment( $action ) {
|
||||||
check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
|
check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
|
||||||
|
|
||||||
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
||||||
|
$post = get_post( $comment_post_ID );
|
||||||
|
if ( ! $post )
|
||||||
|
wp_die( -1 );
|
||||||
|
|
||||||
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
|
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
|
||||||
wp_die( -1 );
|
wp_die( -1 );
|
||||||
|
|
||||||
$status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
|
if ( empty( $post->post_status ) )
|
||||||
|
|
||||||
if ( empty($status) )
|
|
||||||
wp_die( 1 );
|
wp_die( 1 );
|
||||||
elseif ( in_array($status, array('draft', 'pending', 'trash') ) )
|
elseif ( in_array($post->post_status, array('draft', 'pending', 'trash') ) )
|
||||||
wp_die( __('ERROR: you are replying to a comment on a draft post.') );
|
wp_die( __('ERROR: you are replying to a comment on a draft post.') );
|
||||||
|
|
||||||
$user = wp_get_current_user();
|
$user = wp_get_current_user();
|
||||||
|
|
Loading…
Reference in New Issue