Make WordPress Core

Ticket #5725: wp-app.diff

File wp-app.diff, 1.4 KB (added by toydi, 17 years ago)

a patch with the proposed enhancement

  • wp-app.php

     
    248248                }
    249249
    250250                $publish = (isset($entry->draft) && trim($entry->draft) == 'yes') ? false : true;
     251        $accept_new_post_as_draft = false;  // auto-convert Contributor's new post to draft?
     252        if ($publish) {
     253            if (!current_user_can('publish_posts')) {
     254                $msg_cant_publish = __('Sorry, you do not have the right to publish new posts.');
    251255
    252                 $cap = ($publish) ? 'publish_posts' : 'edit_posts';
     256                if (!current_user_can('edit_posts')) {
     257                    $this->auth_required($msg_cant_publish);
     258                } elseif ($accept_new_post_as_draft) {
     259                    $publish = false;
     260                } else {
     261                    $this->auth_required($msg_cant_publish . ' ' .
     262                             __('Please submit your post as draft for review.'));
     263                }
     264            }
     265        } else {
     266            if (!current_user_can('edit_posts'))
     267                $this->auth_required(__('Sorry, you do not have the right to submit new posts.'));
     268        }
    253269
    254                 if(!current_user_can($cap))
    255                         $this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.'));
    256 
    257270                $blog_ID = (int ) $blog_id;
    258271                $post_status = ($publish) ? 'publish' : 'draft';
    259272                $post_author = (int) $user_ID;