• Resolved Danstano

    (@danstano)


    I am an admin and the moment I activate the plugin, the admin bar is gone. I have seen a setting under the Football plugin to switch off/on the admin for subscribers. Switching this off/on does change anything. The moment I deactivate the plugin, the admin bar returns. I added myself (admin) to players, is this what’s causing the problem? I am only able to see the admin bar once the plugin is deactivated. I deactivated all other plugins to test but they are not conflicting. Please help and thanks for the replies.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author AntoineH

    (@antoineh)

    The code that uses this option is very simple and only checks for the subscriber role of the logged on user. And it uses a standard WP function for this. So, if the user you are using is a subscriber (WP role), then the bar is not shown. All other users should see the bar; also admins that are playing in the pool.

    If this is not the case, then I can only think of a scenario that some (site) caching or other plugin is causing a problem.

    the code:

    	public static function show_admin_bar( $content ) {
    		// normal users do not get the admin bar after log in
    		$no_show = current_user_can( 'subscriber' ) 
    					&& Football_Pool_Utils::get_fp_option( 'hide_admin_bar', 1 ) == 1;
    		
    		return $no_show ? false : $content;
    	}
    
    Plugin Author AntoineH

    (@antoineh)

    Nevermind, I think I found something. The codex mentions that checking for roles is only partly supported and may cause unreliable results. I haven’t touched this part in years, so maybe they changed this in the mean time.

    What you can try, is to locate the above code and change it to:

    	public static function show_admin_bar( $content ) {
    		$show_bar = true;
    		if ( Football_Pool_Utils::get_fp_option( 'hide_admin_bar', 1 ) == 1 ) {
    			$show_bar = false;
    			// only admins get the admin bar after login when the hide admin bar option is set
    			if ( current_user_can( 'manage_options' ) ) $show_bar = true;
    		}
    		
    		return $show_bar ? $content : false;
    	}
    

    I will do some further testing and add a fix to a future release.

    Please let me know if this fixes your problem ??

    • This reply was modified 5 years ago by AntoineH.
    • This reply was modified 5 years ago by AntoineH. Reason: hotfix
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide_admin_bar for subscribers’ is closed to new replies.