From f812294867b0bea3133fcbc7ac4606e26c067789 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 9 Feb 2006 10:03:48 +0000 Subject: [PATCH] Allow draft pages. Use post_type for object types. Reserve post_status strictly for status. fixes #1820 git-svn-id: http://svn.automattic.com/wordpress/trunk@3510 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-functions.php | 18 +++--- wp-admin/edit-form-advanced.php | 1 + wp-admin/edit-page-form.php | 11 +++- wp-admin/edit-pages.php | 2 +- wp-admin/index.php | 6 +- wp-admin/inline-uploading.php | 8 +-- wp-admin/install.php | 2 +- wp-admin/page-new.php | 2 +- wp-admin/post.php | 10 +-- wp-admin/upgrade-functions.php | 25 +++++++ wp-admin/upgrade-schema.php | 4 +- wp-admin/users.php | 2 +- wp-commentsrss2.php | 4 +- wp-includes/classes.php | 19 +++--- wp-includes/functions-post.php | 72 +++++++++++++-------- wp-includes/functions.php | 16 ++--- wp-includes/template-functions-category.php | 2 +- wp-includes/template-functions-general.php | 18 +++--- wp-includes/template-functions-links.php | 8 +-- wp-includes/template-functions-post.php | 4 +- wp-includes/version.php | 4 +- 21 files changed, 143 insertions(+), 95 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 49004dd17..b381feb08 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -34,13 +34,13 @@ function write_post() { $_POST['post_status'] = 'publish'; if ('' != $_POST['advanced']) $_POST['post_status'] = 'draft'; - if ('' != $_POST['savepage']) - $_POST['post_status'] = 'static'; + //if ('' != $_POST['savepage']) { + // $_POST['post_status'] = 'draft'; if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) $_POST['post_status'] = 'draft'; - if ('static' == $_POST['post_status'] && !current_user_can('edit_pages')) + if ('page' == $_POST['post_type'] && !current_user_can('edit_pages')) die(__('This user cannot edit pages.')); if (!empty ($_POST['edit_date'])) { @@ -154,8 +154,8 @@ function edit_post() { $_POST['post_status'] = 'publish'; if ('' != $_POST['advanced']) $_POST['post_status'] = 'draft'; - if ('' != $_POST['savepage']) - $_POST['post_status'] = 'static'; + //if ('' != $_POST['savepage']) + // $_POST['post_status'] = 'static'; if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) $_POST['post_status'] = 'draft'; @@ -254,7 +254,7 @@ function get_post_to_edit($id) { $post->post_title = format_to_edit($post->post_title); $post->post_title = apply_filters('title_edit_pre', $post->post_title); - if ($post->post_status == 'static') + if ($post->post_type == 'page') $post->page_template = get_post_meta($id, '_wp_page_template', true); return $post; @@ -613,7 +613,7 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) { function page_rows($parent = 0, $level = 0, $pages = 0) { global $wpdb, $class, $post; if (!$pages) - $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order"); + $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' ORDER BY menu_order"); if ($pages) { foreach ($pages as $post) { @@ -1176,7 +1176,7 @@ function page_template_dropdown($default = '') { function parent_dropdown($default = 0, $parent = 0, $level = 0) { global $wpdb, $post_ID; - $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = 'static' ORDER BY menu_order"); + $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order"); if ($items) { foreach ($items as $item) { @@ -1848,7 +1848,7 @@ function the_attachment_links($id = false) { $id = (int) $id; $post = & get_post($id); - if ( $post->post_status != 'attachment' ) + if ( $post->post_type != 'attachment' ) return false; $icon = get_attachment_icon($post->ID); diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 3f9390a89..5ae2a7288 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -51,6 +51,7 @@ if (empty($post->post_status)) $post->post_status = 'draft'; + $_GET['message']) : ?> diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index ae5948974..92045a014 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -30,7 +30,7 @@ if (isset($mode) && 'bookmarklet' == $mode) { - +