From b77e90c5bf7179114bec1a382a7baa3241945490 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 3 Apr 2013 04:34:14 +0000 Subject: [PATCH] No need to check for the presence of a current user in a privileged ajax action. see #23665. git-svn-id: http://core.svn.wordpress.org/trunk@23889 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 35b697ca17..0f7a8a083c 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1042,14 +1042,10 @@ function wp_ajax_autosave() { if ( $_POST['post_type'] == 'page' || empty($_POST['post_category']) ) unset($_POST['post_category']); - $do_autosave = (bool) $_POST['autosave']; $data = ''; $supplemental = array(); $id = $revision_id = 0; - if ( ! $user_id = get_current_user_id() ) - wp_die('-1'); - $post_id = (int) $_POST['post_id']; $_POST['ID'] = $_POST['post_ID'] = $post_id; $post = get_post($post_id); @@ -1064,7 +1060,7 @@ function wp_ajax_autosave() { wp_die( __( 'You are not allowed to edit this post.' ) ); } - if ( $do_autosave ) { + if ( ! empty( $_POST['autosave'] ) ) { // Drafts and auto-drafts are just overwritten by autosave for the same user if ( $user_id == $post->post_author && ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) ) { $id = edit_post();