Make WordPress Core

Ticket #6943: trunk_fix_page_permissions_jun2.diff

File trunk_fix_page_permissions_jun2.diff, 2.8 KB (added by jeremyclarke, 16 years ago)

Trunk june 2: fix page status permissions and page form

  • wp-admin/includes/post.php

     
    6363        // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
    6464        if ( 'page' == $_POST['post_type'] ) {
    6565                if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
    66                         $_POST['post_status'] = 'pending';
     66                        if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
     67                                $_POST['post_status'] = 'pending';
    6768        } else {
    6869                if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) :
    6970                        // Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.
  • wp-admin/edit-page-form.php

     
    7878</div>
    7979
    8080<div class="inside">
    81 
    8281<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
    8382<p>
    8483<select name='post_status' tabindex='4' id='post_status'>
    85 <?php if ( current_user_can('publish_pages') ) : ?>
     84<?php // Show publish in dropdown if user can publish or if they can re-publish this page ('edit_published_pages')
     85// 'publish' option will be selected for published AND private posts (checkbox overrides dropdown)
     86if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) :
     87?>
    8688<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
    87 <?php else: ?>
    88 <option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option>
    8989<?php endif; ?>
    9090<?php if ( 'future' == $post->post_status ) : ?>
    9191<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
     
    9494<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
    9595</select>
    9696</p>
     97<?php if ( current_user_can( 'publish_posts' ) ) : ?>
     98<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>
     99<?php endif; ?>
    97100
    98 <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>
    99101<?php
    100102if ($post_ID) {
    101103        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date