WordPress.org

Ready to get started?Download WordPress

Forums

Simple Login Log
How to hide Users->Login Log sub-menu for sub-sites in MultiSite (4 posts)

  1. Dan & Jennifer
    Member
    Posted 1 year ago #

    Hey Max!

    How can I hide the Users->Login Log sub-menu for sub-sites in MultiSite?

    For example, here's how I remove the Tools-> Delete Site sub-menu:
    remove_submenu_page( 'tools.php', 'ms-delete-site.php' );

    But no matter what I try, it doens't seem to work for Login Log, i.e.
    remove_submenu_page( 'users.php', 'users.php?page=login_log' );

    To make sure this menu item shows on the main site (but not on the sub-sites) I'll wrap it in an if/then: "if($current_site->blog_id != $current_blog->blog_id)"

    But what I don't know is the correct remove_submenu_page() format to remove it.

    Can you please assist? :-)

    Thanks!
    Dan

    http://wordpress.org/extend/plugins/simple-login-log/

  2. Dan & Jennifer
    Member
    Posted 1 year ago #

    Max, I found one solution (below), but it involved editing the plugin file again, which is never a good thing... means we'll have to remember to re-edit it every time there's an update. :-)

    ** All that said, if you have a solution for a correct remove_submenu_page() to remove this item from our menu ourselves without editing the plugin, that would be excellent. :-)

    Thanks!
    Dan

    -----

    Here's the code I updated - could you include something like this in the plugin? :-)

    Just a thought - but a great checkbox on the plugin settings page could be "restrict login log viewing to network super admin only".

    So the goal is to restrict showing Users->Login Log link to only show for super_admin users. of course this only really applies to multiste, so could also wrap that in an additional if/then - and check is_multisite().

    function sll_admin_menu()
    {
        //add_submenu_page( 'users.php', __('Simple Login Log', 'sll'), __('Login Log', 'sll'), 'list_users', 'login_log', array(&$this, 'log_manager') );
    
        // show sub-menu link to super_admin users
        global $user_ID;
    	if ( is_super_admin( $user_ID ) )
        	add_submenu_page( 'users.php', __('Simple Login Log', 'sll'), __('Login Log', 'sll'), 'list_users', 'login_log', array(&$this, 'log_manager') );
    }
  3. Dan & Jennifer
    Member
    Posted 1 year ago #

    Hey Max!

    Just wanted to let you know that on instead of hiding this menu item by editing the code, we're now using "Admin Menu Editor" to hide it. Works great AND i'm not having to touch your code, yay!! :-)

    Thanks!!
    Dan

  4. Max Chirkov
    Member
    Plugin Author

    Posted 1 year ago #

    Good to know. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags