Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global $current_user;
- get_currentuserinfo();
- if ($current_user->user_login != "ishkibbibble") {
- add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );
- function new_wp_dashboard_right_now() {
- global $wp_registered_sidebars;
- $num_posts = wp_count_posts( 'post' );
- $num_pages = wp_count_posts( 'page' );
- $num_cats = wp_count_terms('category');
- $num_tags = wp_count_terms('post_tag');
- echo "\n\t".'<div class="table table_content">';
- echo "\n\t".'<p class="sub">' . __('Content') . '</p>'."\n\t".'<table>';
- echo "\n\t".'<tr class="first">';
- // Posts
- $num = number_format_i18n( $num_posts->publish );
- $text = _n( 'Post', 'Posts', intval($num_posts->publish) );
- if ( current_user_can( 'edit_posts' ) ) {
- $num = "<a href='edit.php'>$num</a>";
- $text = "<a href='edit.php'>$text</a>";
- }
- echo '<td class="first b b-posts">' . $num . '</td>';
- echo '<td class="t posts">' . $text . '</td>';
- echo '</tr><tr>';
- // Pages
- $num = number_format_i18n( $num_pages->publish );
- $text = _n( 'Page', 'Pages', $num_pages->publish );
- if ( current_user_can( 'edit_pages' ) ) {
- $num = "<a href='edit.php?post_type=page'>$num</a>";
- $text = "<a href='edit.php?post_type=page'>$text</a>";
- }
- echo '<td class="first b b_pages">' . $num . '</td>';
- echo '<td class="t pages">' . $text . '</td>';
- echo '</tr><tr>';
- // Categories
- $num = number_format_i18n( $num_cats );
- $text = _n( 'Category', 'Categories', $num_cats );
- if ( current_user_can( 'manage_categories' ) ) {
- $num = "<a href='edit-tags.php?taxonomy=category'>$num</a>";
- $text = "<a href='edit-tags.php?taxonomy=category'>$text</a>";
- }
- echo '<td class="first b b-cats">' . $num . '</td>';
- echo '<td class="t cats">' . $text . '</td>';
- echo '</tr><tr>';
- // Tags
- $num = number_format_i18n( $num_tags );
- $text = _n( 'Tag', 'Tags', $num_tags );
- if ( current_user_can( 'manage_categories' ) ) {
- $num = "<a href='edit-tags.php'>$num</a>";
- $text = "<a href='edit-tags.php'>$text</a>";
- }
- echo '<td class="first b b-tags">' . $num . '</td>';
- echo '<td class="t tags">' . $text . '</td>';
- echo "</tr>";
- do_action('right_now_content_table_end');
- echo "\n\t</table>\n\t</div>";
- echo "\n\t".'<div class="versions">';
- $ct = current_theme_info();
- echo "\n\t<p>";
- if ( empty( $ct->stylesheet_dir ) ) {
- if ( ! is_multisite() || is_super_admin() )
- echo '<span class="error-message">' . __('ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.') . '</span>';
- } elseif ( ! empty($wp_registered_sidebars) ) {
- $sidebars_widgets = wp_get_sidebars_widgets();
- $num_widgets = 0;
- foreach ( (array) $sidebars_widgets as $k => $v ) {
- if ( 'wp_inactive_widgets' == $k || 'orphaned_widgets' == substr( $k, 0, 16 ) )
- continue;
- if ( is_array($v) )
- $num_widgets = $num_widgets + count($v);
- }
- $num = number_format_i18n( $num_widgets );
- $switch_themes = $ct->title;
- if ( current_user_can( 'switch_themes') )
- $switch_themes = '<a href="themes.php">' . $switch_themes . '</a>';
- if ( current_user_can( 'edit_theme_options' ) ) {
- printf(_n('Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $switch_themes, $num);
- } else {
- printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $switch_themes, $num);
- }
- } else {
- if ( current_user_can( 'switch_themes' ) )
- printf( __('Theme <span class="b"><a href="themes.php">%1$s</a></span>'), $ct->title );
- else
- printf( __('Theme <span class="b">%1$s</span>'), $ct->title );
- }
- echo '</p>';
- // Check if search engines are blocked.
- if ( !is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public') ) {
- $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content') );
- $content = apply_filters('privacy_on_link_text', __('Search Engines Blocked') );
- echo "<p><a href='options-privacy.php' title='$title'>$content</a></p>";
- }
- update_right_now_message();
- echo "\n\t".'<br class="clear" /></div>';
- do_action( 'rightnow_end' );
- do_action( 'activity_box_end' );
- }
- function example_remove_dashboard_widgets() {
- remove_meta_box('dashboard_right_now', 'dashboard', 'side');
- remove_menu_page('edit-comments.php');
- wp_add_dashboard_widget( 'dashboard_right_now2', __( 'Right Now' ), 'new_wp_dashboard_right_now' );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement