Make WordPress Core


Ignore:
Timestamp:
06/02/2008 09:01:42 PM (18 years ago)
Author:
ryan
Message:

Don't unpublish posts when a user edit who can edit publised posts but not publih new posts edits a post. Props jeremyclarke. see #7070 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r8011 r8032  
    5858        $_POST['post_status'] = 'draft';
    5959
     60    $previous_status = get_post_field('post_status',  $_POST['ID']);
     61
     62    // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published.
     63    // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
    6064    if ( 'page' == $_POST['post_type'] ) {
    6165        if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
    6266            $_POST['post_status'] = 'pending';
    6367    } else {
    64         if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) )
    65             $_POST['post_status'] = 'pending';
     68        if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) :
     69            // Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.
     70            if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') )
     71                $_POST['post_status'] = 'pending';
     72        endif;
    6673    }
    6774
Note: See TracChangeset for help on using the changeset viewer.