Opened 19 years ago
Closed 18 years ago
#4206 closed defect (bug) (fixed)
Publish button overrides Private post status
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 2.5 | Priority: | high |
| Severity: | major | Version: | 2.1.3 |
| Component: | Administration | Keywords: | has-patch needs-testing |
| Focuses: | 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 (3)
Change History (22)
#1
@
19 years ago
- Milestone changed from 2.1.4 to 2.2
- Resolution set to fixed
- Status changed from new to closed
#6
@
19 years ago
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!
#7
@
19 years ago
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.
#8
@
19 years ago
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;
#9
@
19 years ago
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)
#11
@
19 years ago
+1 for Andy's solution. Patch attached because I'm bored and needed to write some code.
#13
@
18 years ago
+1 to Andy's solution, -1 for current patch.
We should check the current setting of the checkbox, not the one at load time.
#14
@
18 years ago
- Keywords has-patch added
Alternative patch uploaded which warns based on the current setting, not the on load setting.
#16
@
18 years ago
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.
@
18 years ago
Warn users when editing a private post and click publish that continuing will result in the post being public.
#18
@
18 years ago
- Keywords needs-testing added
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.
While we are doing this can there also be an action implemented for "publications" of private posts?