Ticket #1820: save_pages_as_draft.diff
File save_pages_as_draft.diff, 10.3 KB (added by , 20 years ago) |
---|
-
wp-includes/functions-post.php
18 18 $post = & get_post($ID); 19 19 $previous_status = $post->post_status; 20 20 } 21 21 22 22 // Get the basics. 23 23 $post_content = apply_filters('content_save_pre', $post_content); 24 24 $post_excerpt = apply_filters('excerpt_save_pre', $post_excerpt); … … 48 48 // Create a valid post name. Drafts are allowed to have an empty 49 49 // post name. 50 50 if ( empty($post_name) ) { 51 if ( 'draft' != $post_status )51 if ( 'draft' != $post_status && 'static-draft' != $post_status ) 52 52 $post_name = sanitize_title($post_title); 53 53 } else { 54 54 $post_name = sanitize_title($post_name); … … 130 130 $post_ID = $wpdb->insert_id; 131 131 } 132 132 133 if ( empty($post_name) && 'draft' != $post_status ) {133 if ( empty($post_name) && 'draft' != $post_status && 'static-draft' != $post_status ) { 134 134 $post_name = sanitize_title($post_title, $post_ID); 135 135 $wpdb->query( "UPDATE $wpdb->posts SET post_name = '$post_name' WHERE ID = '$post_ID'" ); 136 136 } 137 137 138 138 wp_set_post_cats('', $post_ID, $post_category); 139 139 140 if ( 'static' == $post_status )140 if ( 'static' == $post_status || 'static-draft' == $post_status ) 141 141 clean_page_cache($post_ID); 142 142 else 143 143 clean_post_cache($post_ID); … … 457 457 458 458 do_action('delete_post', $postid); 459 459 460 if ( 'static' == $post->post_status )460 if ( 'static' == $post->post_status || 'static-draft' == $post->post_status) 461 461 $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_status = 'static'"); 462 462 463 463 $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid"); -
wp-includes/classes.php
553 553 $where .= ' AND (post_status = "publish"'; 554 554 555 555 if (isset($user_ID) && ('' != intval($user_ID))) 556 $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static' )";556 $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static' AND post_status != 'static-draft')"; 557 557 else 558 558 $where .= ')'; 559 559 } … … 610 610 // User must be logged in to view unpublished posts. 611 611 $this->posts = array(); 612 612 } else { 613 if ('draft' == $status ) {613 if ('draft' == $status || 'static-draft' == $status) { 614 614 // User must have edit permissions on the draft to preview. 615 615 if (! user_can_edit_post($user_ID, $this->posts[0]->ID)) { 616 616 $this->posts = array(); -
wp-includes/template-functions-links.php
49 49 50 50 $permalink = get_settings('permalink_structure'); 51 51 52 if ( '' != $permalink && 'draft' != $post->post_status ) {52 if ( '' != $permalink && 'draft' != $post->post_status && 'static-draft' != $post->post_status ) { 53 53 $unixtime = strtotime($post->post_date); 54 54 55 55 $category = ''; -
wp-admin/post.php
49 49 $location = 'post.php?posted=true'; 50 50 } 51 51 52 if ( 'static' == $_POST['post_status'] )52 if ( 'static' == $_POST['post_status'] || 'static-draft' == $_POST['post_status'] ) 53 53 $location = "page-new.php?saved=true"; 54 54 55 55 if ( '' != $_POST['advanced'] || isset($_POST['save']) ) … … 71 71 72 72 $post = get_post_to_edit($post_ID); 73 73 74 if ($post->post_status == 'static' )74 if ($post->post_status == 'static' || $post->post_status == 'static-draft') 75 75 include('edit-page-form.php'); 76 76 else 77 77 include('edit-form-advanced.php'); -
wp-admin/admin-functions.php
36 36 $_POST['post_status'] = 'draft'; 37 37 if ('' != $_POST['savepage']) 38 38 $_POST['post_status'] = 'static'; 39 if ('' != $_POST['savepageasdraft']) 40 $_POST['post_status'] = 'static-draft'; 39 41 40 42 if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) 41 43 $_POST['post_status'] = 'draft'; … … 113 115 $_POST['post_status'] = 'draft'; 114 116 if ('' != $_POST['savepage']) 115 117 $_POST['post_status'] = 'static'; 118 if ('' != $_POST['savepageasdraft']) 119 $_POST['post_status'] = 'static-draft'; 116 120 117 121 if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) 118 122 $_POST['post_status'] = 'draft'; … … 204 208 $post->post_title = format_to_edit($post->post_title); 205 209 $post->post_title = apply_filters('title_edit_pre', $post->post_title); 206 210 207 if ($post->post_status == 'static' )211 if ($post->post_status == 'static' || $post->post_status == 'static-draft') 208 212 $post->page_template = get_post_meta($id, '_wp_page_template', true); 209 213 210 214 return $post; -
wp-admin/edit-page-form.php
142 142 <input name="save" type="submit" id="save" tabindex="5" value=" <?php _e('Save and Continue Editing'); ?> "/> 143 143 <input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Edit Page') : _e('Create New Page') ?> »" /> 144 144 <?php else : ?> 145 <input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php _e('Create New Page') ?> »" /> 145 <input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php _e('Create New Page') ?>" /> 146 <input name="savepageasdraft" type="submit" id="savepageasdraft" tabindex="7" value="<?php _e('Save Page as Draft'); ?>" /> 146 147 <?php endif; ?> 147 148 <input name="referredby" type="hidden" id="referredby" value="<?php echo $sendto; ?>" /> 148 149 </p> -
wp-admin/admin-db.php
25 25 return apply_filters('get_others_drafts', $other_drafts); 26 26 } 27 27 28 function get_users_page_drafts( $user_id ) { 29 global $wpdb; 30 $user_id = (int) $user_id; 31 $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'static-draft' AND post_author = $user_id ORDER BY ID DESC"; 32 $query = apply_filters('get_users_page_drafts', $query); 33 return $wpdb->get_results( $query ); 34 } 35 36 function get_others_page_drafts( $user_id ) { 37 global $wpdb; 38 $user = get_userdata( $user_id ); 39 $level_key = $wpdb->prefix . 'user_level'; 40 41 $editable = get_editable_user_ids( $user_id ); 42 43 if( !$editable ) { 44 $other_drafts = ''; 45 } else { 46 $editable = join(',', $editable); 47 $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'static-draft' AND post_author IN ($editable) AND post_author != '$user_id' "); 48 } 49 50 return apply_filters('get_others_drafts', $other_drafts); 51 } 52 28 53 function get_editable_authors( $user_id ) { 29 54 global $wpdb; 30 55 -
wp-admin/execute-pings.php
27 27 } 28 28 } 29 29 // Do Trackbacks 30 if($trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft' ")) {30 if($trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft' AND post_status != 'static-draft'")) { 31 31 foreach($trackbacks as $trackback) { 32 32 //echo "trackback : $trackback->ID<br/>"; 33 33 do_trackbacks($trackback->ID); -
wp-admin/edit-pages.php
5 5 require_once('admin-header.php'); 6 6 ?> 7 7 8 <?php 9 $drafts = get_users_page_drafts($user_ID); 10 $other_drafts = get_others_page_drafts($user_ID); 11 if ($drafts || $other_drafts) { 12 ?> 8 13 <div class="wrap"> 14 <?php if ($drafts) { ?> 15 <p><strong><?php _e('Your Draft Pages:') ?></strong> 16 <?php 17 $i = 0; 18 foreach ($drafts as $draft) { 19 if (0 != $i) 20 echo ', '; 21 $draft->post_title = stripslashes($draft->post_title); 22 if ($draft->post_title == '') 23 $draft->post_title = sprintf(__('Post #%s'), $draft->ID); 24 echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; 25 ++$i; 26 } 27 ?> 28 .</p> 29 <?php } ?> 30 31 <?php if ($other_drafts) { ?> 32 <p><strong><?php _e('Other’s Draft Pages:') ?></strong> 33 <?php 34 $i = 0; 35 foreach ($other_drafts as $draft) { 36 if (0 != $i) 37 echo ', '; 38 $draft->post_title = stripslashes($draft->post_title); 39 if ($draft->post_title == '') 40 $draft->post_title = sprintf(__('Post #%s'), $draft->ID); 41 echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; 42 ++$i; 43 } 44 ?> 45 .</p> 46 47 <?php } ?> 48 49 </div> 50 <?php } ?> 51 52 <div class="wrap"> 9 53 <h2><?php _e('Page Management'); ?></h2> 10 54 <p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page'); ?> »</a></p> 11 55 -
wp-admin/upgrade-schema.php
106 106 post_title text NOT NULL, 107 107 post_category int(4) NOT NULL default '0', 108 108 post_excerpt text NOT NULL, 109 post_status enum('publish','draft','private','static','object' ) NOT NULL default 'publish',109 post_status enum('publish','draft','private','static','object', 'static-draft') NOT NULL default 'publish', 110 110 comment_status enum('open','closed','registered_only') NOT NULL default 'open', 111 111 ping_status enum('open','closed') NOT NULL default 'open', 112 112 post_password varchar(20) NOT NULL default '',