Advertisement
Guest User

Untitled

a guest
May 25th, 2012
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.62 KB | None | 0 0
  1. global $current_user;
  2. get_currentuserinfo();
  3. if ($current_user->user_login != "ishkibbibble") {
  4. add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );
  5. function new_wp_dashboard_right_now() {
  6. global $wp_registered_sidebars;
  7.  
  8. $num_posts = wp_count_posts( 'post' );
  9. $num_pages = wp_count_posts( 'page' );
  10.  
  11. $num_cats = wp_count_terms('category');
  12.  
  13. $num_tags = wp_count_terms('post_tag');
  14. echo "\n\t".'<div class="table table_content">';
  15. echo "\n\t".'<p class="sub">' . __('Content') . '</p>'."\n\t".'<table>';
  16. echo "\n\t".'<tr class="first">';
  17.  
  18. // Posts
  19. $num = number_format_i18n( $num_posts->publish );
  20. $text = _n( 'Post', 'Posts', intval($num_posts->publish) );
  21. if ( current_user_can( 'edit_posts' ) ) {
  22. $num = "<a href='edit.php'>$num</a>";
  23. $text = "<a href='edit.php'>$text</a>";
  24. }
  25.  
  26. echo '<td class="first b b-posts">' . $num . '</td>';
  27. echo '<td class="t posts">' . $text . '</td>';
  28.  
  29. echo '</tr><tr>';
  30.  
  31. // Pages
  32. $num = number_format_i18n( $num_pages->publish );
  33. $text = _n( 'Page', 'Pages', $num_pages->publish );
  34. if ( current_user_can( 'edit_pages' ) ) {
  35. $num = "<a href='edit.php?post_type=page'>$num</a>";
  36. $text = "<a href='edit.php?post_type=page'>$text</a>";
  37. }
  38. echo '<td class="first b b_pages">' . $num . '</td>';
  39. echo '<td class="t pages">' . $text . '</td>';
  40.  
  41. echo '</tr><tr>';
  42.  
  43. // Categories
  44. $num = number_format_i18n( $num_cats );
  45. $text = _n( 'Category', 'Categories', $num_cats );
  46. if ( current_user_can( 'manage_categories' ) ) {
  47. $num = "<a href='edit-tags.php?taxonomy=category'>$num</a>";
  48. $text = "<a href='edit-tags.php?taxonomy=category'>$text</a>";
  49. }
  50. echo '<td class="first b b-cats">' . $num . '</td>';
  51. echo '<td class="t cats">' . $text . '</td>';
  52.  
  53. echo '</tr><tr>';
  54.  
  55. // Tags
  56. $num = number_format_i18n( $num_tags );
  57. $text = _n( 'Tag', 'Tags', $num_tags );
  58. if ( current_user_can( 'manage_categories' ) ) {
  59. $num = "<a href='edit-tags.php'>$num</a>";
  60. $text = "<a href='edit-tags.php'>$text</a>";
  61. }
  62. echo '<td class="first b b-tags">' . $num . '</td>';
  63. echo '<td class="t tags">' . $text . '</td>';
  64.  
  65. echo "</tr>";
  66. do_action('right_now_content_table_end');
  67. echo "\n\t</table>\n\t</div>";
  68. echo "\n\t".'<div class="versions">';
  69. $ct = current_theme_info();
  70.  
  71. echo "\n\t<p>";
  72.  
  73. if ( empty( $ct->stylesheet_dir ) ) {
  74. if ( ! is_multisite() || is_super_admin() )
  75. echo '<span class="error-message">' . __('ERROR: The themes directory is either empty or doesn&#8217;t exist. Please check your installation.') . '</span>';
  76. } elseif ( ! empty($wp_registered_sidebars) ) {
  77. $sidebars_widgets = wp_get_sidebars_widgets();
  78. $num_widgets = 0;
  79. foreach ( (array) $sidebars_widgets as $k => $v ) {
  80. if ( 'wp_inactive_widgets' == $k || 'orphaned_widgets' == substr( $k, 0, 16 ) )
  81. continue;
  82. if ( is_array($v) )
  83. $num_widgets = $num_widgets + count($v);
  84. }
  85. $num = number_format_i18n( $num_widgets );
  86.  
  87. $switch_themes = $ct->title;
  88. if ( current_user_can( 'switch_themes') )
  89. $switch_themes = '<a href="themes.php">' . $switch_themes . '</a>';
  90. if ( current_user_can( 'edit_theme_options' ) ) {
  91. 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);
  92. } else {
  93. 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);
  94. }
  95. } else {
  96. if ( current_user_can( 'switch_themes' ) )
  97. printf( __('Theme <span class="b"><a href="themes.php">%1$s</a></span>'), $ct->title );
  98. else
  99. printf( __('Theme <span class="b">%1$s</span>'), $ct->title );
  100. }
  101. echo '</p>';
  102.  
  103. // Check if search engines are blocked.
  104. if ( !is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public') ) {
  105. $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content') );
  106. $content = apply_filters('privacy_on_link_text', __('Search Engines Blocked') );
  107.  
  108. echo "<p><a href='options-privacy.php' title='$title'>$content</a></p>";
  109. }
  110.  
  111. update_right_now_message();
  112.  
  113. echo "\n\t".'<br class="clear" /></div>';
  114. do_action( 'rightnow_end' );
  115. do_action( 'activity_box_end' );
  116. }
  117. function example_remove_dashboard_widgets() {
  118. remove_meta_box('dashboard_right_now', 'dashboard', 'side');
  119. remove_menu_page('edit-comments.php');
  120. wp_add_dashboard_widget( 'dashboard_right_now2', __( 'Right Now' ), 'new_wp_dashboard_right_now' );
  121. }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement