Support » Plugin: If Menu - Visibility control for Menus » multi-site 'User is logged in' condition

  • Resolved Justin Fletcher

    (@justinticktock)


    I noticed that the current option ‘User is logged in’ doesn’t work for multisite as its true for a user no matter which site of a multi-site network they are logged in to. basically ..the current user is logged into the network on one or more sites somewhere.

    to get a multi-site network version for “this user has access to this current site” then we can check the ‘read’ capability. I’ve hooked in and am currently using…

    $conditions[] = array(
    							'name'		=>	__( 'User is logged in for current site', 'if-menu' ),
    							'condition'	=>	'if_user_has_read_cap'
    						);

    and

    // this is necessary to check is user logged in for multisite
    function if_user_has_read_cap() {
    
        if ( current_user_can('read') ) {
            return True;
        } else {
    	return false;
        }
    }

    not sure if you want to add it in to the main plugin for others to not get confused.

    https://wordpress.org/plugins/if-menu/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘multi-site 'User is logged in' condition’ is closed to new replies.