WordPress.org

Ready to get started?Download WordPress

Forums

Is it possible to hide "My Sites" from site users in Multisite? (4 posts)

  1. expfarm
    Member
    Posted 1 year ago #

    The topic title says it all:
    Is it possible to hide "My Sites" from site users in Multisite?

    I am trying to build a support forum for our clients by using Multisite and few clever plugins I found. But I've been unable to find a way to remove both the "Add New Post" and "My Sites" from the admin bar.

    Thanks for your help!

  2. David Sader
    Member
    Posted 1 year ago #

    I use a plugin, my own plugin, to do it.

    http://wordpress.org/extend/plugins/menus/screenshots/

    Something like this would do exactly what you have asked for (note the exception for the SuperAdmin).

    <?php
    add_filter( 'admin_bar_menu', 'my_favorite_actions', 999 );
    function my_favorite_actions($wp_toolbar) {
    	if( is_super_admin() )
    		return $wp_toolbar;
    
    	if( current_user_can('read') )
    		$wp_toolbar->remove_node( 'my-sites' );
    
    	if( current_user_can('edit_posts') )
    		$wp_toolbar->remove_node( 'new-post' );
    }
    ?>
  3. expfarm
    Member
    Posted 1 year ago #

    If I used the code you listed, which file does that code belong in?

    Thanks!

  4. David Sader
    Member
    Posted 1 year ago #

    /wp-content/mu-plugins/my_favorite_actions.php

    Any snippets and custom bits of code can be run automagically when placed in mu-plugins folder.

    Create your own plugin header and you are off to the races.

    http://markjaquith.wordpress.com/2006/03/04/wp-tutorial-your-first-wp-plugin/

Topic Closed

This topic has been closed to new replies.

About this Topic