Don't unpublish pages when a user who can edit publised pages but not publish new pages edits a page. Props jeremyclarke. see #6943 #7070 for trunk

git-svn-id: https://develop.svn.wordpress.org/trunk@8034 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-06-03 06:44:40 +00:00
parent 07518727b8
commit b0a0139c4d
2 changed files with 9 additions and 6 deletions

View File

@ -78,14 +78,14 @@ else
</div>
<div class="inside">
<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
<p>
<select name='post_status' tabindex='4' id='post_status'>
<?php if ( current_user_can('publish_pages') ) : ?>
<?php // Show publish in dropdown if user can publish or if they can re-publish this page ('edit_published_pages')
// 'publish' option will be selected for published AND private posts (checkbox overrides dropdown)
if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) :
?>
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
<?php else: ?>
<option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option>
<?php endif; ?>
<?php if ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
@ -94,8 +94,10 @@ else
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
</select>
</p>
<?php if ( current_user_can( 'publish_posts' ) ) : ?>
<p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
<?php endif; ?>
<?php
if ($post_ID) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date

View File

@ -63,7 +63,8 @@ function _wp_translate_postdata( $update = false ) {
// Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
if ( 'page' == $_POST['post_type'] ) {
if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
$_POST['post_status'] = 'pending';
if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
$_POST['post_status'] = 'pending';
} else {
if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) :
// Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.