Support » Plugin: Simple Login Log » How to hide Users->Login Log sub-menu for sub-sites in MultiSite

  • 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? 🙂


Viewing 3 replies - 1 through 3 (of 3 total)
  • 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. 🙂



    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') );

    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!! 🙂


    Plugin Author Max Chirkov


    Good to know. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to hide Users->Login Log sub-menu for sub-sites in MultiSite’ is closed to new replies.