Changeset 5707
- Timestamp:
- 06/14/2007 04:24:28 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r5587 r5707 102 102 <fieldset id="poststatusdiv" class="dbx-box"> 103 103 <h3 class="dbx-handle"><?php _e('Post Status') ?></h3> 104 <div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?> 105 <label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label> 106 <?php endif; ?> 104 <div class="dbx-content"> 105 <?php if ( current_user_can('publish_posts') ) : ?> 106 <label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label> 107 <?php endif; ?> 108 <label for="post_status_pending" class="selectit"><input id="post_status_pending" name="post_status" type="radio" value="pending" <?php checked($post->post_status, 'pending'); ?> /> <?php _e('Pending Review') ?></label> 107 109 <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label> 108 110 <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div> … … 168 170 <?php if ( current_user_can('publish_posts') ) : ?> 169 171 <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> 172 <?php else : ?> 173 <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" /> 170 174 <?php endif; ?> 171 175 <?php -
trunk/wp-admin/edit-post-rows.php
r5575 r5707 11 11 <tbody id="the-list"> 12 12 <?php 13 if ( $posts) {13 if ( have_posts() ) { 14 14 $bgcolor = ''; 15 15 while (have_posts()) : the_post(); … … 98 98 </tr> 99 99 <?php 100 } // end if ( $posts)100 } // end if ( have_posts() ) 101 101 ?> 102 102 </tbody> -
trunk/wp-admin/edit.php
r5667 r5707 12 12 'draft' => array(__('Draft'), _c('Drafts|manage posts header')), 13 13 'future' => array(__('Scheduled'), __('Scheduled posts')), 14 'pending' => array(__('Pending Review'), __('Pending posts')), 14 15 'private' => array(__('Private'), __('Private posts')), 15 16 'publish' => array(__('Published'), __('Published posts')) 16 17 ); 18 19 $avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'"); 17 20 18 21 $post_status_q = ''; … … 31 34 32 35 // define the columns to display, the syntax is 'internal name' => 'display name' 33 $posts_columns = array( 34 'id' => '<div style="text-align: center">' . __('ID') . '</div>', 35 'date' => __('When'), 36 'title' => __('Title'), 37 'categories' => __('Categories'), 38 'comments' => '<div style="text-align: center">' . __('Comments') . '</div>', 39 'author' => __('Author') 40 ); 36 $posts_columns = array(); 37 $posts_columns['id'] = '<div style="text-align: center">' . __('ID') . '</div>'; 38 if ( !in_array($_GET['post_status'], array('pending', 'draft')) ) 39 $posts_columns['date'] = __('When'); 40 $posts_columns['title'] = __('Title'); 41 $posts_columns['categories'] = __('Categories'); 42 if ( 'publish' == $_GET['post_status'] ) 43 $posts_columns['comments'] = '<div style="text-align: center">' . __('Comments') . '</div>'; 44 $posts_columns['author'] = __('Author'); 45 41 46 $posts_columns = apply_filters('manage_posts_columns', $posts_columns); 42 47 … … 58 63 // Use $_GET instead of is_ since they can override each other 59 64 $h2_author = ''; 60 if ( isset($_GET['author']) && $_GET['author'] ) { 61 $author_user = get_userdata( get_query_var( 'author' ) ); 62 $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name )); 65 $_GET['author'] = (int) $_GET['author']; 66 if ( $_GET['author'] != 0 ) { 67 if ( $_GET['author'] == '-' . $user_ID ) { // author exclusion 68 $h2_author = ' ' . __('by other authors'); 69 } else { 70 $author_user = get_userdata( get_query_var( 'author' ) ); 71 $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name )); 72 } 63 73 } 64 74 $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( get_search_query() ) ) : ''; … … 74 84 </fieldset> 75 85 76 <fieldset><legend><?php _e(' Post Type…'); ?></legend>86 <fieldset><legend><?php _e('Status…'); ?></legend> 77 87 <select name='post_status'> 78 88 <option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option> 79 <?php foreach ( $post_stati as $status => $label ) : ?>89 <?php foreach ( $post_stati as $status => $label ) : if ( !in_array($status, $avail_post_stati) ) continue; ?> 80 90 <option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option> 81 91 <?php endforeach; ?> -
trunk/wp-admin/includes/post.php
r5566 r5707 65 65 if ( 'page' == $_POST['post_type'] ) { 66 66 if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_pages' )) 67 $_POST['post_status'] = ' draft';67 $_POST['post_status'] = 'pending'; 68 68 } else { 69 69 if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_posts' )) 70 $_POST['post_status'] = ' draft';70 $_POST['post_status'] = 'pending'; 71 71 } 72 72 … … 269 269 if ( 'page' == $_POST['post_type'] ) { 270 270 if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) ) 271 $_POST['post_status'] = ' draft';271 $_POST['post_status'] = 'pending'; 272 272 } else { 273 273 if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) 274 $_POST['post_status'] = ' draft';274 $_POST['post_status'] = 'pending'; 275 275 } 276 276 -
trunk/wp-admin/includes/schema.php
r5700 r5707 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','attachment','inherit','future' ) NOT NULL default 'publish',109 post_status enum('publish','draft','private','static','object','attachment','inherit','future', 'pending') 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', -
trunk/wp-admin/includes/template.php
r5700 r5707 421 421 422 422 if ( $for_post ) 423 $edit = ( ('draft' == $post->post_status) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true;423 $edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true; 424 424 425 425 echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>'; -
trunk/wp-admin/includes/user.php
r5566 r5707 182 182 } 183 183 184 function get_others_ drafts( $user_id) {184 function get_others_unpublished_posts($user_id, $type='any') { 185 185 global $wpdb; 186 186 $user = get_userdata( $user_id ); … … 189 189 $editable = get_editable_user_ids( $user_id ); 190 190 191 if ( in_array($type, array('draft', 'pending')) ) 192 $type_sql = " post_status = '$type' "; 193 else 194 $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; 195 191 196 if( !$editable ) { 192 $other_ drafts = '';197 $other_unpubs = ''; 193 198 } else { 194 199 $editable = join(',', $editable); 195 $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' "); 196 } 197 198 return apply_filters('get_others_drafts', $other_drafts); 200 $other_unpubs = $wpdb->get_results("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != '$user_id' "); 201 } 202 203 return apply_filters('get_others_drafts', $other_unpubs); 204 } 205 206 function get_others_drafts($user_id) { 207 return get_others_unpublished_posts($user_id, 'draft'); 208 } 209 210 function get_others_pending($user_id) { 211 return get_others_unpublished_posts($user_id, 'pending'); 199 212 } 200 213 -
trunk/wp-admin/post-new.php
r5676 r5707 25 25 <?php 26 26 endif; 27 ?> 27 28 28 if ( $drafts = get_users_drafts( $user_ID ) ) { ?> 29 <div class="wrap"> 30 <p><strong><?php _e('Your Drafts:') ?></strong> 29 31 30 <?php 32 // Show drafts. 33 $num_drafts = count($drafts); 34 if ( $num_drafts > 15 ) $num_drafts = 15; 35 for ( $i = 0; $i < $num_drafts; $i++ ) { 36 $draft = $drafts[$i]; 37 if ( 0 != $i ) 38 echo ', '; 39 if ( empty($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>"; 31 $my_drafts = get_users_drafts($user_ID); 32 $pending = get_others_pending($user_ID); 33 $others_drafts = get_others_drafts($user_ID); 34 35 if ( !empty($my_drafts) || !empty($pending) || !empty($others_drafts) ) { 36 echo '<div class="wrap" id="draft-nag">'; 37 38 if ( $my_drafts ) { 39 echo '<p><strong>' . __( 'Your Drafts:' ) . '</strong> '; 40 if ( count($my_drafts) < 3 ) { 41 $i = 0; 42 foreach ( $my_drafts as $post ) { 43 if ( $i++ != 0 ) 44 echo ', '; 45 echo '<a href="post.php?action=edit&post=' . $post->ID . '">'; 46 the_title(); 47 echo '</a>'; 48 } 49 echo '.</p>'; 50 } else { 51 printf( 52 __( 'You have <a href="%s">%d drafts</a>.' ) . '</p>', 53 'edit.php?post_status=draft&author=' . $user_ID, count($my_drafts) 54 ); 55 } 42 56 } 43 57 44 if ( 15 < count($drafts) ) { ?> 45 , <a href="edit.php"><?php echo sprintf(__('and %s more »'), (count($drafts) - 15) ); ?></a> 46 <?php } ?> 47 .</p> 48 </div> 58 if ( $pending ) { 59 echo '<p><strong>' . __( 'Pending Review:' ) . '</strong> '; 60 if ( count($pending) < 3 ) { 61 $i = 0; 62 foreach ( $pending as $post ) { 63 if ( $i++ != 0 ) 64 echo ', '; 65 echo '<a href="post.php?action=edit&post=' . $post->ID . '">'; 66 the_title(); 67 echo '</a>'; 68 } 69 echo '.</p>'; 70 } else { 71 printf( 72 __( 'There are <a href="%s">%d drafts pending review</a>.' ) . '</p>', 73 'edit.php?post_status=pending', count($pending) 74 ); 75 } 76 } 77 78 if ( $others_drafts ) { 79 echo '<p><strong>' . __( 'Others’ Drafts:' ) . '</strong> '; 80 if ( count($others_drafts) < 3 ) { 81 $i = 0; 82 foreach ( $others_drafts as $post ) { 83 if ( $i++ != 0 ) 84 echo ', '; 85 echo '<a href="post.php?action=edit&post=' . $post->ID . '">'; 86 the_title(); 87 echo '</a>'; 88 } 89 echo '.</p>'; 90 } else { 91 printf( 92 __( 'There are <a href="%s">%d in-progress drafts by other authors</a>.' ) . '</p>', 93 'edit.php?post_status=pending&author=-' . $user_ID, count($others_drafts) 94 ); 95 } 96 } 97 98 echo "</div>\n"; 99 } 100 ?> 101 102 49 103 <?php 50 }51 52 104 // Show post form. 53 105 $post = get_default_post_to_edit(); -
trunk/wp-comments-post.php
r5640 r5707 20 20 do_action('comment_closed', $comment_post_ID); 21 21 wp_die( __('Sorry, comments are closed for this item.') ); 22 } elseif ( 'draft' == $status->post_status) {22 } elseif ( in_array($status->post_status, array('draft', 'pending') ) ) { 23 23 do_action('comment_on_draft', $comment_post_ID); 24 24 exit; -
trunk/wp-includes/post-template.php
r5700 r5707 163 163 $output .= '<a href="' . get_permalink() . '">'; 164 164 } else { 165 if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status)165 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 166 166 $output .= '<a href="' . get_permalink() . '&page=' . $i . '">'; 167 167 else … … 182 182 $output .= '<a href="' . get_permalink() . '">' . $previouspagelink . '</a>'; 183 183 } else { 184 if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status)184 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 185 185 $output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $previouspagelink . '</a>'; 186 186 else … … 193 193 $output .= '<a href="' . get_permalink() . '">' . $nextpagelink . '</a>'; 194 194 } else { 195 if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status)195 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 196 196 $output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $nextpagelink . '</a>'; 197 197 else -
trunk/wp-includes/post.php
r5700 r5707 554 554 // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now 555 555 if (empty($post_date)) { 556 if ( 'draft' != $post_status)556 if ( !in_array($post_status, array('draft', 'pending')) ) 557 557 $post_date = current_time('mysql'); 558 558 } 559 559 560 560 if (empty($post_date_gmt)) { 561 if ( 'draft' != $post_status)561 if ( !in_array($post_status, array('draft', 'pending')) ) 562 562 $post_date_gmt = get_gmt_from_date($post_date); 563 563 } … … 739 739 740 740 // Drafts shouldn't be assigned a date unless explicitly done so by the user 741 if ( 'draft' == $post['post_status']&& empty($postarr['edit_date']) && empty($postarr['post_date']) &&741 if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) && empty($postarr['post_date']) && 742 742 ('0000-00-00 00:00:00' == $post['post_date']) ) 743 743 $clear_date = true; -
trunk/wp-includes/query.php
r5700 r5707 1007 1007 if ( in_array( 'draft' , $q_status ) ) 1008 1008 $r_status[] = "post_status = 'draft'"; 1009 if ( in_array( 'pending', $q_status ) ) 1010 $r_status[] = "post_status = 'pending'"; 1009 1011 if ( in_array( 'future' , $q_status ) ) 1010 1012 $r_status[] = "post_status = 'future'"; … … 1021 1023 1022 1024 if ( is_admin() ) 1023 $where .= " OR post_status = 'future' OR post_status = 'draft' ";1025 $where .= " OR post_status = 'future' OR post_status = 'draft' OR post_status = 'pending'"; 1024 1026 1025 1027 if ( is_user_logged_in() ) { … … 1129 1131 $this->posts = array(); 1130 1132 } else { 1131 if ('draft' == $status) {1133 if (in_array($status, array('draft', 'pending')) ) { 1132 1134 // User must have edit permissions on the draft to preview. 1133 1135 if (! current_user_can('edit_post', $this->posts[0]->ID)) { -
trunk/wp-includes/version.php
r5539 r5707 4 4 5 5 $wp_version = '2.3-alpha'; 6 $wp_db_version = 55 39;6 $wp_db_version = 5540; 7 7 8 8 ?>
Note: See TracChangeset
for help on using the changeset viewer.