diff --git a/wp-admin/edit.php b/wp-admin/edit.php
index 6a31a86d7..27361910c 100644
--- a/wp-admin/edit.php
+++ b/wp-admin/edit.php
@@ -112,6 +112,14 @@ if ( empty($title) )
$parent_file = 'edit.php';
wp_enqueue_script('inline-edit-post');
+$user_posts = false;
+if ( !current_user_can('edit_others_posts') ) {
+ $user_posts_count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(1) FROM $wpdb->posts WHERE post_type = 'post' AND post_status != 'trash' AND post_author = %d", $current_user->ID) );
+ $user_posts = true;
+ if ( $user_posts_count && empty($_GET['post_status']) && empty($_GET['all_posts']) && empty($_GET['author']) )
+ $_GET['author'] = $current_user->ID;
+}
+
list($post_stati, $avail_post_stati) = wp_edit_posts_query();
require_once('admin-header.php');
@@ -179,10 +187,19 @@ $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated'
if ( empty($locked_post_status) ) :
$status_links = array();
$num_posts = wp_count_posts( 'post', 'readable' );
-$total_posts = array_sum( (array) $num_posts ) - $num_posts->trash;
-$class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
-$status_links[] = "
" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '';
+$class = '';
+$allposts = '';
+if ( $user_posts ) {
+ if ( $_GET['author'] == $current_user->ID )
+ $class = ' class="current"';
+ $status_links[] = "" . sprintf( _nx( 'My Posts (%s)', 'My Posts (%s)', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '';
+ $allposts = '?all_posts=1';
+}
+
+$total_posts = array_sum( (array) $num_posts ) - $num_posts->trash;
+$class = empty($class) && empty($_GET['post_status']) ? ' class="current"' : '';
+$status_links[] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '';
foreach ( $post_stati as $status => $label ) {
$class = '';
@@ -192,10 +209,11 @@ foreach ( $post_stati as $status => $label ) {
if ( empty( $num_posts->$status ) )
continue;
+
if ( isset($_GET['post_status']) && $status == $_GET['post_status'] )
$class = ' class="current"';
- $status_links[] = "" . sprintf( _n( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '';
+ $status_links[] = "" . sprintf( _n( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '';
}
echo implode( " |\n", $status_links ) . '';
unset( $status_links );
@@ -339,7 +357,12 @@ if ( $page_links )
-
+
@@ -347,9 +370,7 @@ if ( $page_links )
-
-