From 60bc7f83f4baeb53a4a50221ca0613f5c20f8059 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sun, 17 Jul 2005 21:08:47 +0000 Subject: [PATCH] Fix draft list and publish button. fixes #1514 git-svn-id: https://develop.svn.wordpress.org/trunk@2723 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-functions.php | 21 ++++++++++++++------- wp-admin/post.php | 4 +++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 545f3e6258..25bf68936c 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -24,16 +24,16 @@ function write_post() { if ( ($_POST['post_author'] != $_POST['user_ID']) && ! current_user_can('edit_others_posts') ) die( __('You cannot post as this user.') ); - if ( 'publish' == $_POST['post_status'] && ! current_user_can('publish_posts') ) - $_POST['post_status'] = 'draft'; - // What to do based on which button they pressed if ('' != $_POST['saveasdraft']) $_POST['post_status'] = 'draft'; if ('' != $_POST['saveasprivate']) $_POST['post_status'] = 'private'; if ('' != $_POST['publish']) $_POST['post_status'] = 'publish'; if ('' != $_POST['advanced']) $_POST['post_status'] = 'draft'; if ('' != $_POST['savepage']) $_POST['post_status'] = 'static'; - + + if ( 'publish' == $_POST['post_status'] && ! current_user_can('publish_posts') ) + $_POST['post_status'] = 'draft'; + if ( !empty($_POST['edit_date']) ) { $aa = $_POST['aa']; $mm = $_POST['mm']; @@ -60,9 +60,6 @@ function write_post() { function edit_post() { global $user_ID; - if ( !isset($blog_ID) ) - $blog_ID = 1; - $post_ID = (int) $_POST['post_ID']; if ( ! current_user_can('edit_post', $post_ID) ) @@ -86,6 +83,16 @@ function edit_post() { if ( ($_POST['post_author'] != $_POST['user_ID']) && ! current_user_can('edit_others_posts') ) die( __('You cannot post as this user.') ); + // What to do based on which button they pressed + if ('' != $_POST['saveasdraft']) $_POST['post_status'] = 'draft'; + if ('' != $_POST['saveasprivate']) $_POST['post_status'] = 'private'; + if ('' != $_POST['publish']) $_POST['post_status'] = 'publish'; + if ('' != $_POST['advanced']) $_POST['post_status'] = 'draft'; + if ('' != $_POST['savepage']) $_POST['post_status'] = 'static'; + + if ( 'publish' == $_POST['post_status'] && ! current_user_can('publish_posts') ) + $_POST['post_status'] = 'draft'; + if ( !empty($_POST['edit_date']) ) { $aa = $_POST['aa']; $mm = $_POST['mm']; diff --git a/wp-admin/post.php b/wp-admin/post.php index e77a4d644c..bf6a15ac23 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -326,7 +326,9 @@ default:

15 ) $num_drafts = 15; + for ( $i = 0; $i < $num_drafts; $i++ ) { $draft = $drafts[$i]; if ( 0 != $i ) echo ', ';