WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#27795 closed defect (bug) (duplicate)

Contributor Role unable to 'Save Draft' posts

Reported by: stylemo Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8.2
Component: Posts, Post Types Keywords: has-patch needs-testing
Focuses: administration Cc:

Description (last modified by SergeyBiryukov)

After updating to 3.8.2, the Contributor role can't 'Save Draft' anymore.

Logged in as 'contributor', when I try to save the posts as draft, all the fields become blank and the post is lost and not saved at all. This only happened when the site auto-updated to 3.8.2.

Probably a related issue of #27734

Attachments (2)

27795.patch (769 bytes) - added by SergeyBiryukov 7 years ago.
27795.diff (1.9 KB) - added by dd32 7 years ago.

Download all attachments as: .zip

Change History (17)

#1 @nacin
7 years ago

Hi stylemo, are you referring to the "Quick Draft" box on the dashboard? That's a known issue covered in #27734.

I cannot reproduce any issues with a contributor pressing "Save Draft" while editing post (as in, on post.php?action=edit). I also imagine if we had broken this we would have received more than one bug report about it in five days. Could you describe what exactly is going on? Any JS console errors? PHP errors logged? Any plugins?

#2 @stylemo
7 years ago

Hi nacin. No, I'm not referring to the "Quick Draft" box but I am referring to the main editor page when composing a post as a 'contributor' role. 'Save Draft' button when submitted clears the title field but not the other fields (custom meta fields isn't cleared). And when I check the Draft posts section, the posts isn't there so it's not saved at all.

Sorry, I wish I could give you more debug info but the best I could describe the problem and I hope that helps.

I could confirm that 'Save Draft' posts recently work on 3.8.1 and lower versions.

#3 @nacin
7 years ago

stylemo, I still cannot reproduce, I'm sorry. Do you have any plugins installed? Are you able to reproduce this without any plugins activated on a 3.8.2 install?

#4 @SergeyBiryukov
7 years ago

  • Component changed from General to Posts, Post Types
  • Description modified (diff)
  • Milestone changed from Awaiting Review to 3.8.3

Confirmed.

  1. Log in as a contributor and go to Add New Post screen.
  2. Enter just the post title and click "Save Draft".
  3. The title becomes blank again, and the post is not listed on the Posts screen.

Does not happen in 3.8.1 or trunk, only in 3.8.2.

#5 @dd32
7 years ago

Enter just the post title and click "Save Draft".

There's an important step here that's somewhat not obvious, which is why I couldn't repro this earlier, you can't let it set the slug, you have to go directly from Title -> Save Draft with no stopping inbetween.

#6 @SergeyBiryukov
7 years ago

  • Keywords has-patch added

Appears to be triggered by [27976]. [28073] fixed edit_post(), but not _wp_translate_postdata().

In trunk, we have (since [27405]):

if ( ! isset( $post_data['post_status'] ) ) { 
	$post_data['post_status'] = 'auto-draft' === $previous_status ? 'draft' : $previous_status; 
}

In 3.8 and 3.7 branches, it's:

if ( ! isset($post_data['post_status']) ) {
	$post_data['post_status'] = $previous_status;

27795.patch (for 3.8 branch) fixes this for me.

Last edited 7 years ago by SergeyBiryukov (previous) (diff)

@dd32
7 years ago

#7 @dd32
7 years ago

  • Keywords needs-testing added

27795.diff is a patch I was working on that makes use of the existing auto-draft -> draft conversion which takes place inside edit_post() (line 206-208), this also avoids an unset index notice in that same block ($post_data['post_status'] is unset on 206 in this case). I've added extra context to the patch to see that logic.

SergeyBiryukov's patch does exactly the same thing really, it just happens in a different function,

#8 follow-ups: @nacin
7 years ago

I can reproduce this bug on 3.8.2, but I can't reproduce this bug on the current 3.8 branch. This appears to be fixed for me by [28073].

I will also note that any auto-draft lost this way is recovered by [28075]. Nice.

#9 @nacin
7 years ago

As in: I don't find a patch to be necessary here. But wondering what I'm missing.

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


7 years ago

#11 @ocean90
7 years ago

I could reproduce the steps by SergeyBiryukov, but only before [28073], not after (current branch).

#12 @mikeschroder
7 years ago

I am also not able to reproduce post [28073] in the 3.8 branch. Is a further patch is necessary for other reasons?

Last edited 7 years ago by mikeschroder (previous) (diff)

#13 @nacin
7 years ago

  • Milestone 3.8.3 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Closing as a duplicate of #27734.

#14 in reply to: ↑ 8 @dd32
7 years ago

Replying to nacin:

I can reproduce this bug on 3.8.2, but I can't reproduce this bug on the current 3.8 branch. This appears to be fixed for me by [28073].

I will also note that any auto-draft lost this way is recovered by [28075]. Nice.

Confirmed again. I was mistakenly on the 3.8.2 tag instead of the 3.8 branch.

#15 in reply to: ↑ 8 @SergeyBiryukov
7 years ago

Replying to nacin:

I can reproduce this bug on 3.8.2, but I can't reproduce this bug on the current 3.8 branch. This appears to be fixed for me by [28073].

Yes, I was testing 3.8.2, not the branch. Sorry for the confusion.

Note: See TracTickets for help on using tickets.