Introducing post_status="pending". see #4446 and put any initial bug reports on that ticket

git-svn-id: http://svn.automattic.com/wordpress/trunk@5707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-06-14 16:24:28 +00:00
parent e211aa64e7
commit 7f44512c5d
13 changed files with 139 additions and 58 deletions

View File

@ -101,9 +101,11 @@ addLoadEvent(focusit);
<fieldset id="poststatusdiv" class="dbx-box"> <fieldset id="poststatusdiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Post Status') ?></h3> <h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
<div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?> <div class="dbx-content">
<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> <?php if ( current_user_can('publish_posts') ) : ?>
<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>
<?php endif; ?> <?php endif; ?>
<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>
<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> <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>
<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> <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>
</fieldset> </fieldset>
@ -167,6 +169,8 @@ if ('publish' != $post->post_status || 0 == $post_ID) {
?> ?>
<?php if ( current_user_can('publish_posts') ) : ?> <?php if ( current_user_can('publish_posts') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
<?php else : ?>
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
<?php endif; ?> <?php endif; ?>
<?php <?php
} }

View File

@ -10,7 +10,7 @@
</thead> </thead>
<tbody id="the-list"> <tbody id="the-list">
<?php <?php
if ($posts) { if ( have_posts() ) {
$bgcolor = ''; $bgcolor = '';
while (have_posts()) : the_post(); while (have_posts()) : the_post();
add_filter('the_title','wp_specialchars'); add_filter('the_title','wp_specialchars');
@ -97,7 +97,7 @@ endwhile;
<td colspan="8"><?php _e('No posts found.') ?></td> <td colspan="8"><?php _e('No posts found.') ?></td>
</tr> </tr>
<?php <?php
} // end if ($posts) } // end if ( have_posts() )
?> ?>
</tbody> </tbody>
</table> </table>

View File

@ -11,10 +11,13 @@ $_GET['cat'] = (int) $_GET['cat'];
$post_stati = array( // array( adj, noun ) $post_stati = array( // array( adj, noun )
'draft' => array(__('Draft'), _c('Drafts|manage posts header')), 'draft' => array(__('Draft'), _c('Drafts|manage posts header')),
'future' => array(__('Scheduled'), __('Scheduled posts')), 'future' => array(__('Scheduled'), __('Scheduled posts')),
'pending' => array(__('Pending Review'), __('Pending posts')),
'private' => array(__('Private'), __('Private posts')), 'private' => array(__('Private'), __('Private posts')),
'publish' => array(__('Published'), __('Published posts')) 'publish' => array(__('Published'), __('Published posts'))
); );
$avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'");
$post_status_q = ''; $post_status_q = '';
$post_status_label = _c('Posts|manage posts header'); $post_status_label = _c('Posts|manage posts header');
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
@ -30,14 +33,16 @@ if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($
wp("what_to_show=posts$post_status_q&posts_per_page=15"); wp("what_to_show=posts$post_status_q&posts_per_page=15");
// define the columns to display, the syntax is 'internal name' => 'display name' // define the columns to display, the syntax is 'internal name' => 'display name'
$posts_columns = array( $posts_columns = array();
'id' => '<div style="text-align: center">' . __('ID') . '</div>', $posts_columns['id'] = '<div style="text-align: center">' . __('ID') . '</div>';
'date' => __('When'), if ( !in_array($_GET['post_status'], array('pending', 'draft')) )
'title' => __('Title'), $posts_columns['date'] = __('When');
'categories' => __('Categories'), $posts_columns['title'] = __('Title');
'comments' => '<div style="text-align: center">' . __('Comments') . '</div>', $posts_columns['categories'] = __('Categories');
'author' => __('Author') if ( 'publish' == $_GET['post_status'] )
); $posts_columns['comments'] = '<div style="text-align: center">' . __('Comments') . '</div>';
$posts_columns['author'] = __('Author');
$posts_columns = apply_filters('manage_posts_columns', $posts_columns); $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
// you can not edit these at the moment // you can not edit these at the moment
@ -57,10 +62,15 @@ if ( is_single() ) {
$h2_noun = $post_status_label; $h2_noun = $post_status_label;
// Use $_GET instead of is_ since they can override each other // Use $_GET instead of is_ since they can override each other
$h2_author = ''; $h2_author = '';
if ( isset($_GET['author']) && $_GET['author'] ) { $_GET['author'] = (int) $_GET['author'];
if ( $_GET['author'] != 0 ) {
if ( $_GET['author'] == '-' . $user_ID ) { // author exclusion
$h2_author = ' ' . __('by other authors');
} else {
$author_user = get_userdata( get_query_var( 'author' ) ); $author_user = get_userdata( get_query_var( 'author' ) );
$h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name )); $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
} }
}
$h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching &#8220;%s&#8221;'), wp_specialchars( get_search_query() ) ) : ''; $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching &#8220;%s&#8221;'), wp_specialchars( get_search_query() ) ) : '';
$h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in &#8220;%s&#8221;'), single_cat_title('', false) ) : ''; $h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in &#8220;%s&#8221;'), single_cat_title('', false) ) : '';
$h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : ''; $h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : '';
@ -73,10 +83,10 @@ if ( is_single() ) {
<input type="text" name="s" id="s" value="<?php the_search_query(); ?>" size="17" /> <input type="text" name="s" id="s" value="<?php the_search_query(); ?>" size="17" />
</fieldset> </fieldset>
<fieldset><legend><?php _e('Post Type&hellip;'); ?></legend> <fieldset><legend><?php _e('Status&hellip;'); ?></legend>
<select name='post_status'> <select name='post_status'>
<option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option> <option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
<?php foreach ( $post_stati as $status => $label ) : ?> <?php foreach ( $post_stati as $status => $label ) : if ( !in_array($status, $avail_post_stati) ) continue; ?>
<option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option> <option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>

View File

@ -64,10 +64,10 @@ function edit_post() {
if ( 'page' == $_POST['post_type'] ) { if ( 'page' == $_POST['post_type'] ) {
if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_pages' )) if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_pages' ))
$_POST['post_status'] = 'draft'; $_POST['post_status'] = 'pending';
} else { } else {
if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_posts' )) if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_posts' ))
$_POST['post_status'] = 'draft'; $_POST['post_status'] = 'pending';
} }
if (!isset( $_POST['comment_status'] )) if (!isset( $_POST['comment_status'] ))
@ -268,10 +268,10 @@ function wp_write_post() {
if ( 'page' == $_POST['post_type'] ) { if ( 'page' == $_POST['post_type'] ) {
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) ) if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
$_POST['post_status'] = 'draft'; $_POST['post_status'] = 'pending';
} else { } else {
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) )
$_POST['post_status'] = 'draft'; $_POST['post_status'] = 'pending';
} }
if (!isset( $_POST['comment_status'] )) if (!isset( $_POST['comment_status'] ))

View File

@ -106,7 +106,7 @@ CREATE TABLE $wpdb->posts (
post_title text NOT NULL, post_title text NOT NULL,
post_category int(4) NOT NULL default '0', post_category int(4) NOT NULL default '0',
post_excerpt text NOT NULL, post_excerpt text NOT NULL,
post_status enum('publish','draft','private','static','object','attachment','inherit','future') NOT NULL default 'publish', post_status enum('publish','draft','private','static','object','attachment','inherit','future', 'pending') NOT NULL default 'publish',
comment_status enum('open','closed','registered_only') NOT NULL default 'open', comment_status enum('open','closed','registered_only') NOT NULL default 'open',
ping_status enum('open','closed') NOT NULL default 'open', ping_status enum('open','closed') NOT NULL default 'open',
post_password varchar(20) NOT NULL default '', post_password varchar(20) NOT NULL default '',

View File

@ -420,7 +420,7 @@ function touch_time( $edit = 1, $for_post = 1 ) {
global $wp_locale, $post, $comment; global $wp_locale, $post, $comment;
if ( $for_post ) if ( $for_post )
$edit = ( ('draft' == $post->post_status ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true; $edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true;
echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>'; echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>';

View File

@ -181,21 +181,34 @@ function get_nonauthor_user_ids() {
return $wpdb->get_col( $query ); return $wpdb->get_col( $query );
} }
function get_others_drafts( $user_id ) { function get_others_unpublished_posts($user_id, $type='any') {
global $wpdb; global $wpdb;
$user = get_userdata( $user_id ); $user = get_userdata( $user_id );
$level_key = $wpdb->prefix . 'user_level'; $level_key = $wpdb->prefix . 'user_level';
$editable = get_editable_user_ids( $user_id ); $editable = get_editable_user_ids( $user_id );
if ( in_array($type, array('draft', 'pending')) )
$type_sql = " post_status = '$type' ";
else
$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
if( !$editable ) { if( !$editable ) {
$other_drafts = ''; $other_unpubs = '';
} else { } else {
$editable = join(',', $editable); $editable = join(',', $editable);
$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' "); $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' ");
} }
return apply_filters('get_others_drafts', $other_drafts); return apply_filters('get_others_drafts', $other_unpubs);
}
function get_others_drafts($user_id) {
return get_others_unpublished_posts($user_id, 'draft');
}
function get_others_pending($user_id) {
return get_others_unpublished_posts($user_id, 'pending');
} }
function get_user_to_edit( $user_id ) { function get_user_to_edit( $user_id ) {

View File

@ -24,31 +24,83 @@ if ( isset($_GET['posted']) && $_GET['posted'] ) : ?>
<div id="message" class="updated fade"><p><strong><?php _e('Post saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post &raquo;'); ?></a></p></div> <div id="message" class="updated fade"><p><strong><?php _e('Post saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post &raquo;'); ?></a></p></div>
<?php <?php
endif; endif;
?>
if ( $drafts = get_users_drafts( $user_ID ) ) { ?>
<div class="wrap">
<p><strong><?php _e('Your Drafts:') ?></strong>
<?php <?php
// Show drafts. $my_drafts = get_users_drafts($user_ID);
$num_drafts = count($drafts); $pending = get_others_pending($user_ID);
if ( $num_drafts > 15 ) $num_drafts = 15; $others_drafts = get_others_drafts($user_ID);
for ( $i = 0; $i < $num_drafts; $i++ ) {
$draft = $drafts[$i]; if ( !empty($my_drafts) || !empty($pending) || !empty($others_drafts) ) {
if ( 0 != $i ) echo '<div class="wrap" id="draft-nag">';
if ( $my_drafts ) {
echo '<p><strong>' . __( 'Your Drafts:' ) . '</strong> ';
if ( count($my_drafts) < 3 ) {
$i = 0;
foreach ( $my_drafts as $post ) {
if ( $i++ != 0 )
echo ', '; echo ', ';
if ( empty($draft->post_title) ) echo '<a href="post.php?action=edit&amp;post=' . $post->ID . '">';
$draft->post_title = sprintf(__('Post # %s'), $draft->ID); the_title();
echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; echo '</a>';
}
echo '.</p>';
} else {
printf(
__( 'You have <a href="%s">%d drafts</a>.' ) . '</p>',
'edit.php?post_status=draft&author=' . $user_ID, count($my_drafts)
);
}
} }
if ( 15 < count($drafts) ) { ?> if ( $pending ) {
, <a href="edit.php"><?php echo sprintf(__('and %s more &raquo;'), (count($drafts) - 15) ); ?></a> echo '<p><strong>' . __( 'Pending Review:' ) . '</strong> ';
<?php } ?> if ( count($pending) < 3 ) {
.</p> $i = 0;
</div> foreach ( $pending as $post ) {
<?php if ( $i++ != 0 )
} echo ', ';
echo '<a href="post.php?action=edit&amp;post=' . $post->ID . '">';
the_title();
echo '</a>';
}
echo '.</p>';
} else {
printf(
__( 'There are <a href="%s">%d drafts pending review</a>.' ) . '</p>',
'edit.php?post_status=pending', count($pending)
);
}
}
if ( $others_drafts ) {
echo '<p><strong>' . __( 'Others&#8217; Drafts:' ) . '</strong> ';
if ( count($others_drafts) < 3 ) {
$i = 0;
foreach ( $others_drafts as $post ) {
if ( $i++ != 0 )
echo ', ';
echo '<a href="post.php?action=edit&amp;post=' . $post->ID . '">';
the_title();
echo '</a>';
}
echo '.</p>';
} else {
printf(
__( 'There are <a href="%s">%d in-progress drafts by other authors</a>.' ) . '</p>',
'edit.php?post_status=pending&author=-' . $user_ID, count($others_drafts)
);
}
}
echo "</div>\n";
}
?>
<?php
// Show post form. // Show post form.
$post = get_default_post_to_edit(); $post = get_default_post_to_edit();
include('edit-form-advanced.php'); include('edit-form-advanced.php');

View File

@ -19,7 +19,7 @@ if ( empty($status->comment_status) ) {
} elseif ( 'closed' == $status->comment_status ) { } elseif ( 'closed' == $status->comment_status ) {
do_action('comment_closed', $comment_post_ID); do_action('comment_closed', $comment_post_ID);
wp_die( __('Sorry, comments are closed for this item.') ); wp_die( __('Sorry, comments are closed for this item.') );
} elseif ( 'draft' == $status->post_status ) { } elseif ( in_array($status->post_status, array('draft', 'pending') ) ) {
do_action('comment_on_draft', $comment_post_ID); do_action('comment_on_draft', $comment_post_ID);
exit; exit;
} }

View File

@ -162,7 +162,7 @@ function wp_link_pages($args = '') {
if ( 1 == $i ) { if ( 1 == $i ) {
$output .= '<a href="' . get_permalink() . '">'; $output .= '<a href="' . get_permalink() . '">';
} else { } else {
if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status ) if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
$output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">'; $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
else else
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
@ -181,7 +181,7 @@ function wp_link_pages($args = '') {
if ( 1 == $i ) { if ( 1 == $i ) {
$output .= '<a href="' . get_permalink() . '">' . $previouspagelink . '</a>'; $output .= '<a href="' . get_permalink() . '">' . $previouspagelink . '</a>';
} else { } else {
if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status ) if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
$output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $previouspagelink . '</a>'; $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $previouspagelink . '</a>';
else else
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $previouspagelink . '</a>'; $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $previouspagelink . '</a>';
@ -192,7 +192,7 @@ function wp_link_pages($args = '') {
if ( 1 == $i ) { if ( 1 == $i ) {
$output .= '<a href="' . get_permalink() . '">' . $nextpagelink . '</a>'; $output .= '<a href="' . get_permalink() . '">' . $nextpagelink . '</a>';
} else { } else {
if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status ) if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
$output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $nextpagelink . '</a>'; $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $nextpagelink . '</a>';
else else
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $nextpagelink . '</a>'; $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $nextpagelink . '</a>';

View File

@ -553,12 +553,12 @@ function wp_insert_post($postarr = array()) {
// If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
if (empty($post_date)) { if (empty($post_date)) {
if ( 'draft' != $post_status ) if ( !in_array($post_status, array('draft', 'pending')) )
$post_date = current_time('mysql'); $post_date = current_time('mysql');
} }
if (empty($post_date_gmt)) { if (empty($post_date_gmt)) {
if ( 'draft' != $post_status ) if ( !in_array($post_status, array('draft', 'pending')) )
$post_date_gmt = get_gmt_from_date($post_date); $post_date_gmt = get_gmt_from_date($post_date);
} }
@ -738,7 +738,7 @@ function wp_update_post($postarr = array()) {
$post_cats = $post['post_category']; $post_cats = $post['post_category'];
// Drafts shouldn't be assigned a date unless explicitly done so by the user // Drafts shouldn't be assigned a date unless explicitly done so by the user
if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) && if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
('0000-00-00 00:00:00' == $post['post_date']) ) ('0000-00-00 00:00:00' == $post['post_date']) )
$clear_date = true; $clear_date = true;
else else

View File

@ -1006,6 +1006,8 @@ class WP_Query {
$r_status = array(); $r_status = array();
if ( in_array( 'draft' , $q_status ) ) if ( in_array( 'draft' , $q_status ) )
$r_status[] = "post_status = 'draft'"; $r_status[] = "post_status = 'draft'";
if ( in_array( 'pending', $q_status ) )
$r_status[] = "post_status = 'pending'";
if ( in_array( 'future' , $q_status ) ) if ( in_array( 'future' , $q_status ) )
$r_status[] = "post_status = 'future'"; $r_status[] = "post_status = 'future'";
if ( in_array( 'inherit' , $q_status ) ) if ( in_array( 'inherit' , $q_status ) )
@ -1020,7 +1022,7 @@ class WP_Query {
$where .= " AND (post_status = 'publish'"; $where .= " AND (post_status = 'publish'";
if ( is_admin() ) if ( is_admin() )
$where .= " OR post_status = 'future' OR post_status = 'draft'"; $where .= " OR post_status = 'future' OR post_status = 'draft' OR post_status = 'pending'";
if ( is_user_logged_in() ) { if ( is_user_logged_in() ) {
$where .= current_user_can( "read_private_{$post_type}s" ) ? " OR post_status = 'private'" : " OR post_author = $user_ID AND post_status = 'private'"; $where .= current_user_can( "read_private_{$post_type}s" ) ? " OR post_status = 'private'" : " OR post_author = $user_ID AND post_status = 'private'";
@ -1128,7 +1130,7 @@ class WP_Query {
// User must be logged in to view unpublished posts. // User must be logged in to view unpublished posts.
$this->posts = array(); $this->posts = array();
} else { } else {
if ('draft' == $status) { if (in_array($status, array('draft', 'pending')) ) {
// User must have edit permissions on the draft to preview. // User must have edit permissions on the draft to preview.
if (! current_user_can('edit_post', $this->posts[0]->ID)) { if (! current_user_can('edit_post', $this->posts[0]->ID)) {
$this->posts = array(); $this->posts = array();

View File

@ -3,6 +3,6 @@
// This holds the version number in a separate file so we can bump it without cluttering the SVN // This holds the version number in a separate file so we can bump it without cluttering the SVN
$wp_version = '2.3-alpha'; $wp_version = '2.3-alpha';
$wp_db_version = 5539; $wp_db_version = 5540;
?> ?>