Opened 12 years ago
Closed 9 years ago
#21787 closed defect (bug) (worksforme)
While editing post, View Post link disappears if post status gets set to anything other than 'publish'
Reported by: | ericlewis | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | has-patch |
Focuses: | Cc: |
Description
To reproduce, edit a post and change the Visibility to private. You'll notice the 'View Post' link next to the slug editor disappear.
I would suggest that we match the interface here with the way the 'View Post' link works in the admin bar: check read_post cap for the user against the post, and display accordingly.
Attachments (1)
Change History (11)
#2
follow-up:
↓ 3
@
12 years ago
Hmm, that current_user_can()
is redundant. Is there a case where a user can edit a post but cannot view it? The fix would be:
if ( 'publish' == $post->post_status || 'private' == $post->post_status ) ...
#3
in reply to:
↑ 2
@
12 years ago
Replying to azaozz:
Is there a case where a user can edit a post but cannot view it?
Not that I know. I assumed there was a case I'm not aware of because of the cap check within the admin bar. If there isn't, we should probably leave out the cap check here and also take it out of the admin bar View Post code. The cap check was put in by nacin in r18194, maybe he has a thought.
#4
@
12 years ago
- Cc kovshenin added
- Keywords editoral-flow added
- Milestone changed from Awaiting Review to 3.6
Since we're reworking post statuses in 3.6, I believe they should be taken into account, since there may be other public post statuses. I also think the button (and the admin bar menu item, and the admin notice on update) should be labelled with the correct action: Preview if it's pending review (protected), View if it's public.
Anyway, that doesn't really solve this ticket, because Private is not a public post status, and not a protected one either. It's a private post status, suggesting that it's visible only within the admin, which is not true. Any thoughts on this?
#7
@
11 years ago
This has been bugging me on a site that I've been working on, where we have a lot of private posts: it's furstrating that the View Post button doesn't appear when in the editor screen, even though the user has permission to view the post, and a View link appears in the list of posts. I have tested 21787.diff and it works as one would expect.
Use read_post capability to decide whether to display "View Post" link next to slug editor. Also simplified a 'title' attribute text here, which described slug editing based on post status.