Ticket #5858: 5858.diff
| File 5858.diff, 5.6 KB (added by , 18 years ago) |
|---|
-
wp-admin/includes/dashboard.php
22 22 /* Register Widgets and Controls */ 23 23 24 24 // Recent Comments Widget 25 if ( $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) {25 if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) { 26 26 $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments ); 27 27 $notice = "<a href='moderation.php'>$notice</a>"; 28 28 } else { … … 127 127 do_action( 'wp_dashboard_setup' ); 128 128 129 129 // Hard code the sidebar's widgets and order 130 $dashboard_widgets = array( 'dashboard_recent_comments', 'dashboard_incoming_links', 'dashboard_primary', 'dashboard_plugins', 'dashboard_secondary' ); 130 $dashboard_widgets = array(); 131 $dashboard_widgets[] = 'dashboard_recent_comments'; 132 $dashboard_widgets[] = 'dashboard_incoming_links'; 133 $dashboard_widgets[] = 'dashboard_primary'; 134 if ( current_user_can( 'activate_plugins' ) ) 135 $dashboard_widgets[] = 'dashboard_plugins'; 136 $dashboard_widgets[] = 'dashboard_secondary'; 131 137 132 138 // Filter widget order 133 139 $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', $dashboard_widgets ); -
wp-admin/index.php
39 39 <h2><?php _e('Dashboard'); ?></h2> 40 40 41 41 <div id="rightnow"> 42 <h3 class="reallynow"><span><?php _e('Right Now'); ?></span> <a href="post-new.php" class="rbutton"><strong><?php _e('Write a New Post'); ?></strong></a> <a href="page-new.php" class="rbutton"><?php _e('Write a New Page'); ?></a><br class="clear" /></h3> 42 <h3 class="reallynow"> 43 <span><?php _e('Right Now'); ?></span> 43 44 45 <?php if ( $can_edit_posts = current_user_can( 'edit_posts' ) ) : ?> 46 <a href="post-new.php" class="rbutton"><strong><?php _e('Write a New Post'); ?></strong></a> 47 <?php endif; if ( $can_edit_pages = current_user_can( 'edit_pages' ) ) : ?> 48 <a href="page-new.php" class="rbutton"><?php _e('Write a New Page'); ?></a> 49 <?php endif; ?> 50 <br class="clear" /> 51 </h3> 52 44 53 <?php 45 54 $num_posts = wp_count_posts( 'post' ); 46 55 $num_pages = wp_count_posts( 'page' ); … … 51 60 52 61 $post_type_texts = array(); 53 62 54 if ( !empty($num_posts->publish) ) { 55 $post_type_texts[] = '<a href="edit.php">'.sprintf( __ngettext( '%s post', '%s posts', $num_posts->publish ), number_format_i18n( $num_posts->publish ) ).'</a>'; 63 if ( !empty($num_posts->publish) ) { // with feeds, anyone can tell how many posts there are. Just unlink if !current_user_can 64 $post_text = sprintf( __ngettext( '%s post', '%s posts', $num_posts->publish ), number_format_i18n( $num_posts->publish ) ); 65 $post_type_texts[] = $can_edit_posts ? "<a href='edit.php'>$post_text</a>" : $post_text; 56 66 } 57 if ( !empty($num_pages->publish) ) {67 if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can 58 68 $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>'; 59 69 } 60 if ( !empty($num_posts->draft) ) {70 if ( $can_edit_posts && !empty($num_posts->draft) ) { 61 71 $post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( __ngettext( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>'; 62 72 } 63 if ( !empty($num_posts->future) ) {73 if ( $can_edit_posts && !empty($num_posts->future) ) { 64 74 $post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( __ngettext( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>'; 65 75 } 66 76 67 $cats_text = '<a href="categories.php">'.sprintf( __ngettext( '%s category', '%s categories', $num_cats ), number_format_i18n( $num_cats ) ).'</a>'; 68 $tags_text = '<a href="edit-tags.php">'.sprintf( __ngettext( '%s tag', '%s tags', $num_tags ), number_format_i18n( $num_tags ) ).'</a>'; 77 $cats_text = sprintf( __ngettext( '%s category', '%s categories', $num_cats ), number_format_i18n( $num_cats ) ); 78 $tags_text = sprintf( __ngettext( '%s tag', '%s tags', $num_tags ), number_format_i18n( $num_tags ) ); 79 if ( current_user_can( 'manage_categories' ) ) { 80 $cats_text = "<a href='categories.php'>$cats_text</a>"; 81 $tags_text = "<a href='edit-tags.php'>$tags_text</a>"; 82 } 69 83 70 84 $post_type_text = implode(', ', $post_type_texts); 71 85 … … 79 93 $sidebars_widgets = wp_get_sidebars_widgets(); 80 94 $num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ) ); 81 95 $widgets_text = sprintf( __ngettext( '%d widget', '%d widgets', $num_widgets ), $num_widgets ); 96 if ( $can_switch_themes = current_user_can( 'switch_themes' ) ) 97 $widgets_text = "<a href='widgets.php'>$widgets_text</a>"; 82 98 ?> 83 <p><?php printf( __( 'You are using %1$s theme with %2$s.' ), $ct->title, "<a href='widgets.php'>$widgets_text</a>" ); ?> <a href="themes.php" class="rbutton"><?php _e('Change Theme'); ?></a> You're using BetaPress TODO.</p> 99 <p> 100 <?php printf( __( 'You are using %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?> 101 <?php if ( $can_switch_themes ) : ?> 102 <a href="themes.php" class="rbutton"><?php _e('Change Theme'); ?></a> 103 <?php endif; ?> 104 You're using BetaPress TODO. 105 </p> 84 106 <?php do_action( 'rightnow_end' ); ?> 85 107 <?php do_action( 'activity_box_end' ); ?> 86 108 </div><!-- rightnow -->
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)