Add autosave_generate_nonces action. Props prettyboymp. fixes #10634

git-svn-id: http://svn.automattic.com/wordpress/trunk@11851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-08-20 16:57:11 +00:00
parent 3553ccdbb4
commit 28f552efa5
1 changed files with 5 additions and 6 deletions

View File

@ -957,15 +957,14 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
case 'autosave-generate-nonces' : case 'autosave-generate-nonces' :
check_ajax_referer( 'autosave', 'autosavenonce' ); check_ajax_referer( 'autosave', 'autosavenonce' );
$ID = (int) $_POST['post_ID']; $ID = (int) $_POST['post_ID'];
if($_POST['post_type'] == 'post') { if ( $_POST['post_type'] == 'post' ) {
if(current_user_can('edit_post', $ID)) if ( current_user_can('edit_post', $ID) )
die(wp_create_nonce('update-post_' . $ID)); die(wp_create_nonce('update-post_' . $ID));
} } elseif ( $_POST['post_type'] == 'page' ) {
if($_POST['post_type'] == 'page') { if ( current_user_can('edit_page', $ID) )
if(current_user_can('edit_page', $ID)) {
die(wp_create_nonce('update-page_' . $ID)); die(wp_create_nonce('update-page_' . $ID));
}
} }
do_action('autosave_generate_nonces');
die('0'); die('0');
break; break;
case 'closed-postboxes' : case 'closed-postboxes' :