Users: Remove some links to the dashboard from My Sites for users who cannot access it.
See #41453 Built from https://develop.svn.wordpress.org/trunk@41796 git-svn-id: http://core.svn.wordpress.org/trunk@41630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b25e759621
commit
c9e8431582
|
@ -108,20 +108,33 @@ else :
|
||||||
reset( $blogs );
|
reset( $blogs );
|
||||||
|
|
||||||
foreach ( $blogs as $user_blog ) {
|
foreach ( $blogs as $user_blog ) {
|
||||||
|
switch_to_blog( $user_blog->userblog_id );
|
||||||
|
|
||||||
echo "<li>";
|
echo "<li>";
|
||||||
echo "<h3>{$user_blog->blogname}</h3>";
|
echo "<h3>{$user_blog->blogname}</h3>";
|
||||||
|
|
||||||
|
$actions = "<a href='" . esc_url( home_url() ). "'>" . __( 'Visit' ) . '</a>';
|
||||||
|
|
||||||
|
if ( current_user_can( 'read' ) ) {
|
||||||
|
$actions .= " | <a href='" . esc_url( admin_url() ) . "'>" . __( 'Dashboard' ) . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the row links displayed for each site on the My Sites screen.
|
* Filters the row links displayed for each site on the My Sites screen.
|
||||||
*
|
*
|
||||||
* @since MU (3.0.0)
|
* @since MU (3.0.0)
|
||||||
*
|
*
|
||||||
* @param string $string The HTML site link markup.
|
* @param string $actions The HTML site link markup.
|
||||||
* @param object $user_blog An object containing the site data.
|
* @param object $user_blog An object containing the site data.
|
||||||
*/
|
*/
|
||||||
echo "<p class='my-sites-actions'>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
|
$actions = apply_filters( 'myblogs_blog_actions', $actions, $user_blog );
|
||||||
|
echo "<p class='my-sites-actions'>" . $actions . '</p>';
|
||||||
|
|
||||||
/** This filter is documented in wp-admin/my-sites.php */
|
/** This filter is documented in wp-admin/my-sites.php */
|
||||||
echo apply_filters( 'myblogs_options', '', $user_blog );
|
echo apply_filters( 'myblogs_options', '', $user_blog );
|
||||||
echo "</li>";
|
echo "</li>";
|
||||||
|
|
||||||
|
restore_current_blog();
|
||||||
}?>
|
}?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -520,19 +520,28 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
|
|
||||||
$menu_id = 'blog-' . $blog->userblog_id;
|
$menu_id = 'blog-' . $blog->userblog_id;
|
||||||
|
|
||||||
$wp_admin_bar->add_menu( array(
|
if ( current_user_can( 'read' ) ) {
|
||||||
'parent' => 'my-sites-list',
|
$wp_admin_bar->add_menu( array(
|
||||||
'id' => $menu_id,
|
'parent' => 'my-sites-list',
|
||||||
'title' => $blavatar . $blogname,
|
'id' => $menu_id,
|
||||||
'href' => admin_url(),
|
'title' => $blavatar . $blogname,
|
||||||
) );
|
'href' => admin_url(),
|
||||||
|
) );
|
||||||
|
|
||||||
$wp_admin_bar->add_menu( array(
|
$wp_admin_bar->add_menu( array(
|
||||||
'parent' => $menu_id,
|
'parent' => $menu_id,
|
||||||
'id' => $menu_id . '-d',
|
'id' => $menu_id . '-d',
|
||||||
'title' => __( 'Dashboard' ),
|
'title' => __( 'Dashboard' ),
|
||||||
'href' => admin_url(),
|
'href' => admin_url(),
|
||||||
) );
|
) );
|
||||||
|
} else {
|
||||||
|
$wp_admin_bar->add_menu( array(
|
||||||
|
'parent' => 'my-sites-list',
|
||||||
|
'id' => $menu_id,
|
||||||
|
'title' => $blavatar . $blogname,
|
||||||
|
'href' => home_url(),
|
||||||
|
) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
|
if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
|
||||||
$wp_admin_bar->add_menu( array(
|
$wp_admin_bar->add_menu( array(
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9-beta1-41795';
|
$wp_version = '4.9-beta1-41796';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue