diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php index 9779a9ecb..b4b04ec19 100644 --- a/wp-admin/post-new.php +++ b/wp-admin/post-new.php @@ -32,69 +32,48 @@ $my_drafts = get_users_drafts($user_ID); $pending = get_others_pending($user_ID); $others_drafts = get_others_drafts($user_ID); +$nag_posts_limit = (int) apply_filters('nag_posts_limit', 3); + +$nag_posts = array( + array( + 'my_drafts', + __('Your Drafts:'), + 'edit.php?post_status=draft&author=' . $user_ID, + count($my_drafts)), + array( + 'pending', + __('Pending Review:'), + 'edit.php?post_status=pending', + count($pending)), + array( + 'others_drafts', + __('Others’ Drafts:'), + 'edit.php?post_status=pending&author=-' . $user_ID, + count($others_drafts)) + ); + if ( !empty($my_drafts) || !empty($pending) || !empty($others_drafts) ) { echo '
'; - if ( $my_drafts ) { - echo '

' . __( 'Your Drafts:' ) . ' '; - if ( count($my_drafts) < 3 ) { + foreach ( $nag_posts as $nag ) { + if ( ${$nag[0]} ) { + echo '

' . wp_specialchars($nag[1]) . ' '; $i = 0; - foreach ( $my_drafts as $post ) { - if ( $i++ != 0 ) - echo ', '; + foreach ( ${$nag[0]} as $post ) { + $i++; + if ( $i > $nag_posts_limit ) + break; echo ''; the_title(); echo ''; - } - echo '.

'; - } else { - printf( - __( 'You have %d drafts.' ) . '

', - 'edit.php?post_status=draft&author=' . $user_ID, count($my_drafts) - ); - } - } - - if ( $pending ) { - echo '

' . __( 'Pending Review:' ) . ' '; - if ( count($pending) < 3 ) { - $i = 0; - foreach ( $pending as $post ) { - if ( $i++ != 0 ) + if ( $i < min($nag[3], $nag_posts_limit) ) echo ', '; - echo ''; - the_title(); - echo ''; } + if ( $nag[3] > $nag_posts_limit ) + printf(__(', and %d more'), $nag[2], $nag[3] - $nag_posts_limit); echo '.

'; - } else { - printf( - __( 'There are %d drafts pending review.' ) . '

', - 'edit.php?post_status=pending', count($pending) - ); } } - - if ( $others_drafts ) { - echo '

' . __( 'Others’ Drafts:' ) . ' '; - if ( count($others_drafts) < 3 ) { - $i = 0; - foreach ( $others_drafts as $post ) { - if ( $i++ != 0 ) - echo ', '; - echo ''; - the_title(); - echo ''; - } - echo '.

'; - } else { - printf( - __( 'There are %d in-progress drafts by other authors.' ) . '

', - 'edit.php?post_status=pending&author=-' . $user_ID, count($others_drafts) - ); - } - } - echo "
\n"; } ?>