Make WordPress Core

Opened 14 years ago

Closed 11 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:
Priority: normal Milestone:
Component: Editor Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

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)

21787.diff (1.5 KB ) - added by ericlewis 14 years ago.
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.

Download all attachments as: .zip

Change History (11)

@ericlewis
14 years ago

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.

#1 @SergeyBiryukov
14 years ago

  • Keywords has-patch added

#2 follow-up: @azaozz
14 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 @ericlewis
14 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 @kovshenin
14 years ago

  • Cc kovshenin added
  • Keywords editoral-flow added
  • Milestone Awaiting Review3.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?

#5 @SergeyBiryukov
14 years ago

  • Keywords editorial-flow added; editoral-flow removed

#6 @nacin
13 years ago

  • Milestone 3.6Future Release

#7 @thewanderingbrit
13 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.

#8 @thewanderingbrit
13 years ago

  • Cc dave@… added

#9 @wonderboymusic
12 years ago

"Since we're reworking post statuses in 3.6" #tbt #RIP

#10 @swissspidy
11 years ago

  • Keywords editorial-flow removed
  • Milestone Future Release
  • Resolutionworksforme
  • Status newclosed

As of 4.4, there's no "View post" button anymore. Instead, the permalink is clickable. See #18306

Note: See TracTickets for help on using tickets.