WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#31658 closed defect (bug) (fixed)

Press This: Users lacking the ability to publish should not see a Publish button

Reported by: DrewAPicture Owned by: azaozz
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.2
Component: Press This Keywords: needs-patch
Focuses: ui Cc:

Description

Currently, if a user lacks the capability to publish posts, they still see a Publish button in the Press This window:

http://f.cl.ly/items/2W0S0x230325363V0E26/Screen%20Shot%202015-03-16%20at%201.49.07%20PM.png

And while clicking the Publish button simply appears to save a draft and redirect the user to the editing view within the admin, this workflow could be confusing. That said, I think we have two reasonably good options:

  1. Remove the Publish button. Switch the order of Preview and Save Draft and make Save Draft the primary:

http://f.cl.ly/items/200k3n3V1011141l1Y1a/Screen%20Shot%202015-03-16%20at%201.49.57%20PM.png

  1. Replace the Publish button with a Submit for Review button, and upon clicking it, the post is actually submitted for review, redirecting to the editing screen as expected:

http://f.cl.ly/items/0c1D3r0p0Z0L3X42092e/Screen%20Shot%202015-03-16%20at%202.00.30%20PM.png

The patch I've attached handles the first option above. The second option would require a little more intimate knowledge of how Press This operates.

Attachments (2)

31658.diff (965 bytes) - added by DrewAPicture 7 years ago.
Option #1
31658.2.diff (804 bytes) - added by stephdau 7 years ago.

Download all attachments as: .zip

Change History (6)

@DrewAPicture
7 years ago

Option #1

#1 follow-up: @Michael Arestad
7 years ago

Option 2 is better.

#2 in reply to: ↑ 1 @DrewAPicture
7 years ago

  • Keywords needs-patch added; has-patch removed

Replying to Michael Arestad:

Option 2 is better.

I agree. I think it falls more in line with what users would expect and is the more elegant solution. And in that case, we'll need a new patch.

@stephdau
7 years ago

#3 @stephdau
7 years ago

Since $_POST['status'] used in WP_Press_This::save_post() based on having the publish-button class in the JS:

} else if ( $target.hasClass( 'publish-button' ) ) {
	submitPost( 'publish' );

... that means the caption on the button is irrelevant to the process, and can be switched to "Submit for review", and work as intended.

See 31658.2.diff

Note that we also have more cap checks in press-this.php itself, for the basic stuff.

if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) )
	wp_die( __( 'Cheatin’ uh?' ), 403 );

#4 @azaozz
7 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 31798:

Press This: change the Publish button text to Submit for Review for contributors (like on the Edit Post screen).
Props stephdau, DrewAPicture. Fixes #31658.

Note: See TracTickets for help on using tickets.