Dashboard widgets: Don't link to Pages or Posts for Authors or Contributors respectively.

props mattheu.
see #26574 for trunk.

Built from https://develop.svn.wordpress.org/trunk@26999


git-svn-id: http://core.svn.wordpress.org/trunk@26876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin
2014-01-22 16:52:11 +00:00
parent 74ace0517c
commit 06efe8130d
5 changed files with 29 additions and 13 deletions

View File

@@ -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( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $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( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
} else {
printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
}
}
}
// Comments