[wp-trac] [WordPress Trac] #11082: Saving an empty draft dumps user out to edit.php

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 6 00:59:42 UTC 2010


#11082: Saving an empty draft dumps user out to edit.php
--------------------------+-------------------------------------------------
 Reporter:  markel        |       Owner:  akhilasuram            
     Type:  defect (bug)  |      Status:  assigned               
 Priority:  low           |   Milestone:  3.0                    
Component:  Editor        |     Version:  2.7                    
 Severity:  minor         |    Keywords:  has-patch needs-testing
--------------------------+-------------------------------------------------
Changes (by duck_):

  * keywords:  has-patch needs-refresh => has-patch needs-testing
  * version:  2.9 => 2.7


Comment:

 Patch decides if post is new by checking if {{{$_POST['auto_draft']}}} is
 set to '1'.

 Requires the following (line 147 in wp-includes/autosave.dev.js):
 {{{
 if(postID==parseInt(jQuery("#post_ID").val(),10)){return}
 }}}
 to be removed from wp-includes/autosave.js, because otherwise auto_draft
 field is not set to '0' on autosave, so new posts with a title, content,
 etc. are classified as emptied (patch in related ticket #12859 also
 contains this fix for the same reason).

 Only minimal testing with custom post types, so not sure how well it works
 with them. Even so, I noticed that it wouldn't work with a custom post
 type which didn't support 'title' and 'editor' as an autosave is not
 performed:

 {{{
 wp_nonce_field( 'autosave', 'autosavenonce', false );
 }}}

 is not called by edit-form-advanced.php unless an editor is included and a
 title is needed to trigger an autosave. Therefore, the auto_draft field is
 not set to '0'. (I decided to post this even in light of this as it might
 help someone else)

 (Version bumped back to 2.7 as this behaviour existed then.)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11082#comment:26>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list