Don't let users who cannot publish edit published posts, even their own. Make consistent use of user_can_create_post(). http://mosquito.wordpress.org/view.php?id=1004 Props: MC_incubus

git-svn-id: https://develop.svn.wordpress.org/trunk@2441 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2005-03-14 00:48:11 +00:00
parent c8b826e05b
commit a21f267454
4 changed files with 11 additions and 6 deletions
+7 -2
View File
@@ -61,7 +61,7 @@ case 'post':
if ( empty($post_status) )
$post_status = 'draft';
// Double-check
if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) && 2 != get_option('new_users_can_blog') )
if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) )
$post_status = 'draft';
$comment_status = $_POST['comment_status'];
if ( empty($comment_status) && !isset($_POST['advanced_view']) )
@@ -229,6 +229,11 @@ case 'edit':
if( 'private' == $postdata->post_status && $postdata->post_author != $user_ID )
die ( __('You are not allowed to view other users\' private posts.') );
if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) ) {
_e('You are not allowed to edit published posts.');
break;
}
if ($post_status == 'static') {
$page_template = get_post_meta($post_ID, '_wp_page_template', true);
include('edit-page-form.php');
@@ -305,7 +310,7 @@ case 'editpost':
if (isset($_POST['publish'])) $post_status = 'publish';
// Double-check
if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) && 2 != get_option('new_users_can_blog') )
if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) )
$post_status = 'draft';
if (empty($post_name) || 'draft' == $post_status ) {