Ticket #4206 (closed defect: fixed)

Opened 1 year ago

Last modified 7 months ago

Publish button overrides Private post status

Reported by: mattyrob Assigned to:
Priority: high Milestone: 2.5
Component: Administration Version: 2.1.3
Severity: major Keywords: has-patch needs-testing
Cc:

Description

When writing a new post, if a user sets the post status to "Private" and then clicks publish the post actually goes into the blog as a "Published" post, not a private one.

The code causing this (I think) is the wp_publish_post function in wp-includes/posts.php, it containes the following line:

return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id, 'no_filter' => true));

There are some if statements prior to this that check if the post is already published, perhaps a check could be put here to see if the post is private and a new line added as follows if this evaluates as true.

return wp_update_post(array('post_status' => 'private', 'ID' => $post_id, 'no_filter' => true));

This patch is untried!'''

Attachments

4206.diff (0.9 kB) - added by johnbillion on 05/01/07 01:47:31.
Confirmation message when hitting the Publish button on a Private post (props andy)
4206b.diff (2.5 kB) - added by Nazgul on 09/17/07 22:06:16.
private-post-notification.diff (2.8 kB) - added by JDTrower on 12/20/07 15:39:13.
Warn users when editing a private post and click publish that continuing will result in the post being public.

Change History

04/29/07 04:20:30 changed by rob1n

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone changed from 2.1.4 to 2.2.

04/29/07 04:20:37 changed by rob1n

  • milestone changed from 2.2 to 2.3.

04/29/07 04:20:42 changed by rob1n

  • status changed from closed to reopened.
  • resolution deleted.

04/29/07 04:20:52 changed by rob1n

  • owner changed from anonymous to rob1n.
  • status changed from reopened to new.

04/29/07 07:07:20 changed by mattyrob

While we are doing this can there also be an action implemented for "publications" of private posts?

04/29/07 07:46:10 changed by mattyrob

Finally got around to applying y suggested patch to the trunk files and it doesn't work :-( I guess there is more to it that I thought!

04/29/07 21:18:35 changed by johnbillion

I thought that hitting the 'Publish' button and having the post status set to Published was the desired behaviour. I regularly write posts as drafts and then hit the publish button rather than changing the status to published then hitting save. If I was writing a private post I would set the status to Private and then click the Save button, not the Publish button.

04/30/07 02:31:03 changed by andy

I thought implemented a nice feature to deal with this months ago but I guess I dreamed it.

"Publish" means publish no matter what the status is. When editing a Private post, if you click Publish IT WILL BE PUBLISHED. That's certainly better than saying "Publish means one thing here and another thing here."

The real problem is that people click "Publish" when they mean "Save" and they wish they hadn't. My solution is similar to what we do for the Delete button.

if (
    status == 'private' &&
    !confirm('This post is set to Private. Do you want to Publish this post for the world to see? (If not, try Save.)')
) return false;

04/30/07 06:57:00 changed by mattyrob

It looks like some thoguht has already gone into this but never-the-less it is still confusing IMO.

As Andy says, the risk is users will click Publish when they should click Save to finish their Private posting.

I guess I'm saying "Publish" is like "Print"; while working on a document you may save it and then keep working for longer, or you may save and quit but when you are finished with it and you click print that's the end of the process - whether the document then remains private or goes for wider readship is up to your preferences.

I agree that clikcing Publish should change draft to published, but I don't think it should change the "Private" status of a post.

Perhaps the Publish button should have a drp down option to "Publish as Private" (just throwing ideas out)

04/30/07 23:50:53 changed by foolswisdom

Andy's proposed solution seems like a very good immediate "work around".

05/01/07 01:47:31 changed by johnbillion

  • attachment 4206.diff added.

Confirmation message when hitting the Publish button on a Private post (props andy)

05/01/07 01:47:47 changed by johnbillion

+1 for Andy's solution. Patch attached because I'm bored and needed to write some code.

05/06/07 16:29:10 changed by mattyrob

+1 for this solution; a warning / reminder is better than nothing :-)

09/17/07 17:57:35 changed by Nazgul

+1 to Andy's solution, -1 for current patch.

We should check the current setting of the checkbox, not the one at load time.

09/17/07 22:06:16 changed by Nazgul

  • attachment 4206b.diff added.

09/17/07 22:07:21 changed by Nazgul

  • keywords set to has-patch.

Alternative patch uploaded which warns based on the current setting, not the on load setting.

11/13/07 16:21:29 changed by lloydbudd

  • priority changed from normal to high.
  • severity changed from normal to major.

12/10/07 07:38:02 changed by DD32

4206b.diff

To me that still doesnt help.

While i've never used a private post, my thoughts are that you'd "Publish it as a private post", The wording in the patch suggests to me that thats what happens, NOT that it'll be a published post rather than a private post.

12/19/07 07:29:04 changed by rob1n

  • owner deleted.

12/20/07 15:39:13 changed by JDTrower

  • attachment private-post-notification.diff added.

Warn users when editing a private post and click publish that continuing will result in the post being public.

12/20/07 15:44:56 changed by JDTrower

  • keywords changed from has-patch to has-patch needs-testing.

The attached patch private-post-notification.diff changes the wording from 4206b.diff.

The original wording from 4206.diff was: "This post is set to Private. Are you sure you want to publish this post for the world to see? (If not, try the Save button.)

'OK' to continue, 'Cancel' to stop."

The original wording from 4206b.diff was: "Are you sure you want to publish a private post?"

The current wording is: "Are you sure you want your private post published for the world to see? (If not, try the Save button.)

Click OK to continue publishing or Cancel to stop."

I tested both 4206b.diff and private-post-notification.diff and they both work for me.

02/16/08 16:24:52 changed by westi

  • status changed from new to closed.
  • resolution set to fixed.

(In [6872]) Make sure we can publish private posts. Fixes #5881, #4206.