Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codebunny

    (@codebunny)

    It seems current plugin version is not compatible with the latest version of s2member. You have to do a small code change –

    Open the file
    wp-content\plugins\wp-all-in-one-admin-bar\public\class-wordpress-all-in-one-adminbar.php

    Find this function change_the_visibility_of_admin_bar
    Replace the function change_the_visibility_of_admin_bar from this code,

    function change_the_visibility_of_admin_bar() {
    
    		global $wpaioab_options;
    
    		$current_user = wp_get_current_user();
    		$user_roles = $current_user->roles;
    		$user_role = array_shift($user_roles);
    
    			if(isset($wpaioab_options['wpaioab_'. str_replace(' ', '', strtolower($user_role))])||isset($wpaioab_options['wpaioab_'. str_replace('_', '', strtolower($user_role))])){
    					add_filter('show_admin_bar', '__return_false');
    			}
    	}
    Thread Starter Barn2 Plugins

    (@barn2media)

    Thanks for your reply. If I replace the code as you have said then the whole website goes down!

    Plugin Author codebunny

    (@codebunny)

    The whole website goes down! This may be happened because of a coding error. Please double check the below steps.

    Currently existing function

    function change_the_visibility_of_admin_bar() {
    
    		global $wpaioab_options;
    
    		$current_user = wp_get_current_user();
    		$user_roles = $current_user->roles;
    		$user_role = array_shift($user_roles);
    
    			if(isset($wpaioab_options['wpaioab_'. str_replace(' ', '', strtolower($user_role))])){
    					add_filter('show_admin_bar', '__return_false');
    			}
    	}

    Replace the current function from the below function

    function change_the_visibility_of_admin_bar() {
    
    		global $wpaioab_options;
    
    		$current_user = wp_get_current_user();
    		$user_roles = $current_user->roles;
    		$user_role = array_shift($user_roles);
    
    			if(isset($wpaioab_options['wpaioab_'. str_replace(' ', '', strtolower($user_role))])||isset($wpaioab_options['wpaioab_'. str_replace('_', '', strtolower($user_role))])){
    					add_filter('show_admin_bar', '__return_false');
    			}
    	}

    Is it ?

    Thread Starter Barn2 Plugins

    (@barn2media)

    Thanks for your reply, I think I had pasted the code from the email alert rather than this page. It worked when I pasted it directly from this page.

    Since I have customised the plugin, will it break again when I update the plugin in future? Or will you be fixing this issue in the next release?

    Many thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘'Hide admin bar' options not working’ is closed to new replies.