From ce00f36ab7e2b29117407200bf0e3099692aa079 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 22 Jan 2014 16:51:07 +0000 Subject: [PATCH] Dashboard widgets: Don't link to Pages or Posts for Authors or Contributors respectively. props mattheu. see #26574 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@26999 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/wp-admin.css | 15 ++++++++++----- src/wp-admin/includes/dashboard.php | 8 +++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/css/wp-admin.css b/src/wp-admin/css/wp-admin.css index 44b25669c5..45bd542e5f 100644 --- a/src/wp-admin/css/wp-admin.css +++ b/src/wp-admin/css/wp-admin.css @@ -2965,7 +2965,8 @@ body #dashboard-widgets .postbox form .submit { /* Dashboard right now - Colors */ -#dashboard_right_now li a:before { +#dashboard_right_now li a:before, +#dashboard_right_now li span:before { color: #888; } @@ -2984,12 +2985,14 @@ body #dashboard-widgets .postbox form .submit { margin: 0 0 1em; } -#dashboard_right_now .warning a:before { +#dashboard_right_now .warning a:before, +#dashboard_right_now .warning span:before { color: #d54e21; } /* Dashboard right now - Icons */ -#dashboard_right_now li a:before { +#dashboard_right_now li a:before, +#dashboard_right_now li span:before { content: '\f159'; font: normal 20px/1 'dashicons'; speak: none; @@ -3004,11 +3007,13 @@ body #dashboard-widgets .postbox form .submit { text-decoration: none !important; } -#dashboard_right_now .page-count a:before { +#dashboard_right_now .page-count a:before, +#dashboard_right_now .page-count span:before { content: '\f105'; } -#dashboard_right_now .post-count a:before { +#dashboard_right_now .post-count a:before, +#dashboard_right_now .post-count span:before { content: '\f109'; } diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index afc76f0d15..0f62ebc7df 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -194,7 +194,13 @@ function wp_dashboard_right_now() { $text = _n( '%s Page', '%s Pages', $num_posts->publish ); } $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); - printf( '
  • %2$s
  • ', $post_type, $text ); + $post_type_object = get_post_type_object( $post_type ); + if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { + printf( '
  • %2$s
  • ', $post_type, $text ); + } else { + printf( '
  • %2$s
  • ', $post_type, $text ); + } + } } // Comments