Changeset 11843
- Timestamp:
- 08/19/2009 10:37:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit.php
r11807 r11843 113 113 wp_enqueue_script('inline-edit-post'); 114 114 115 $user_posts = false; 116 if ( !current_user_can('edit_others_posts') ) { 117 $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) ); 118 $user_posts = true; 119 if ( $user_posts_count && empty($_GET['post_status']) && empty($_GET['all_posts']) && empty($_GET['author']) ) 120 $_GET['author'] = $current_user->ID; 121 } 122 115 123 list($post_stati, $avail_post_stati) = wp_edit_posts_query(); 116 124 … … 180 188 $status_links = array(); 181 189 $num_posts = wp_count_posts( 'post', 'readable' ); 190 $class = ''; 191 $allposts = ''; 192 193 if ( $user_posts ) { 194 if ( $_GET['author'] == $current_user->ID ) 195 $class = ' class="current"'; 196 $status_links[] = "<li><a href='edit.php?author=$current_user->ID'$class>" . sprintf( _nx( 'My Posts <span class="count">(%s)</span>', 'My Posts <span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>'; 197 $allposts = '?all_posts=1'; 198 } 199 182 200 $total_posts = array_sum( (array) $num_posts ) - $num_posts->trash; 183 $class = empty( $_GET['post_status'] ) ? ' class="current"' : ''; 184 $status_links[] = "<li><a href='edit.php' $class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>'; 185 201 $class = empty($class) && empty($_GET['post_status']) ? ' class="current"' : ''; 202 $status_links[] = "<li><a href='edit.php{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>'; 186 203 187 204 foreach ( $post_stati as $status => $label ) { … … 193 210 if ( empty( $num_posts->$status ) ) 194 211 continue; 212 195 213 if ( isset($_GET['post_status']) && $status == $_GET['post_status'] ) 196 214 $class = ' class="current"'; 197 215 198 $status_links[] = "<li><a href='edit.php?post_status=$status' 216 $status_links[] = "<li><a href='edit.php?post_status=$status'$class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>'; 199 217 } 200 218 echo implode( " |</li>\n", $status_links ) . '</li>'; … … 340 358 <?php } else { // have_posts() ?> 341 359 <div class="clear"></div> 342 <p><?php _e('No posts found') ?></p> 360 <p><?php 361 if ( 'trash' == $_GET['post_status'] ) 362 _e('No posts found in the trash'); 363 else 364 _e('No posts found'); 365 ?></p> 343 366 <?php } ?> 344 367 … … 348 371 349 372 <div id="ajax-response"></div> 350 351 373 <br class="clear" /> 352 353 374 </div> 354 375
Note: See TracChangeset
for help on using the changeset viewer.