Viewing 15 replies - 1 through 15 (of 16 total)
  • how i can deactivate the function of the admin bar?

    It seems like the function of show/hide admin bar doesn’t load correctly. In screenshot you can see that roles aren’t displayed

    see screenshot
    http://postimage.org/image/chx4exqxj/

    Plugin Contributor barinagabriel

    (@barinagabriel)

    Hello,

    this is a clear case of conflict with another plugin: as you can see the roles are not aligned, and neither does the advertising appear.

    Please deactivate PB, and all other plugins and custom theme you might use (use one of the default ones). Then with PB re-activated, check if it works, whilst re-activating all other plugins one by one.

    Regards,
    Gabriel

    I deactivate PB, and all plugins, activating a default theme, and still doesn’t works, it seems like in wp_options theres a config that conflicts. I just want to delete the function code of admin bar that PB use, where I can do that?

    Plugin Contributor barinagabriel

    (@barinagabriel)

    Hello,

    we don’t recommend altering the plugin’s files, since you will lose any changes made after an update.

    Instead what you could do is deactivate Profile Builder, and look for an option named wppb_display_admin_settings (in the _options table), delete this, and then reactivate PB.

    Gabriel

    I installed PB in a clean and new WordPress 3.5, and with only installed PB still doesn’t work.

    Can you test it?

    Plugin Contributor barinagabriel

    (@barinagabriel)

    Hello,

    are you the same person who posted on Cozmoslabs about this?

    No, I just posted that error here. And I tried again:

    Install a new wordpress 3.5 installation
    Install PB

    The admin bar crash and the roles aren’t loaded.

    Plugin Contributor barinagabriel

    (@barinagabriel)

    Hello,

    as I said to the other user with the same issue: at the moment it seems there are only 2 instances of this error (yours and his), and unfortunately we can’t replicate it ourselves.

    So my question: would it be possible to ask for WP account with admin rights and FTP info so I can check it out myself? This is completely optional, and I understand if you are hesitant, but should you decide to let us(me) try and debug it, you can send the requested info to gabriel@cozmoslabs.com along with a link to this thread and I will take look as soon as I get a little spare time.

    Regards,
    Gabriel

    Email send!

    I had the same issue so I corrected the relevant function in functions.load.php:

    function wppb_show_admin_bar($content){
    	global $current_user;
    
    	$admintSettingsPresent = get_option('wppb_display_admin_settings','not_found');
    
    	if ($admintSettingsPresent != 'not_found' && $current_user->ID)
    		foreach ($current_user->roles as $role_key) {
    			if (empty($GLOBALS['wp_roles']->roles[$role_key]))
    				continue;
    			$role = $GLOBALS['wp_roles']->roles[$role_key];
    			if (isset($admintSettingsPresent[$role['name']])) {
    				if ($admintSettingsPresent[$role['name']] == 'show')
    					return true;
    				if ($admintSettingsPresent[$role['name']] == 'hide')
    					return false;
    			}
    		}
    	return $content;//unmodified
    }

    I also modified the settings page so you don’t have to deactivate+reactivate after adding/editing additional roles:

    <?php
    function wppb_display_admin_settings(){
    ?>
    	<form method="post" action="options.php#show-hide-admin-bar">
    		<input type="hidden" name="wppb_display_admin_settings[dummy]" value="ensure array" />
    	<?php
    		global $wp_roles;
    
    		$wppb_showAdminBar = get_option('wppb_display_admin_settings');
    		settings_fields('wppb_display_admin_settings');
    	?>
    
    	<h2><?php _e('Show/Hide the Admin Bar on Front End', 'profilebuilder');?></h2>
    	<h3><?php _e('Show/Hide the Admin Bar on Front End', 'profilebuilder');?></h3>
    	<table class="wp-list-table widefat fixed pages" cellspacing="0">
    		<thead>
    			<tr>
    				<th id="manage-column" scope="col"><?php _e('User-group', 'profilebuilder');?></th>
    				<th id="manage-column" scope="col"><?php _e('Visibility', 'profilebuilder');?></th>
    			</tr>
    		</thead>
    			<tbody>
    				<?php
    				foreach ($wp_roles->roles as $role) {
    					$key = $role['name'];
    					$setting_exists = !empty($wppb_showAdminBar[$key]);
    					echo'<tr>
    							<td id="manage-columnCell">'.$key.'</td>
    							<td id="manage-columnCell">
    								<input type="radio" name="wppb_display_admin_settings['.$key.']" value="default" ';if (!$setting_exists || $wppb_showAdminBar[$key] == 'default') echo ' checked';echo'/><font size="1">'; _e('Default', 'profilebuilder'); echo'</font><span style="padding-left:20px"></span>
    								<input type="radio" name="wppb_display_admin_settings['.$key.']" value="show"';if ($setting_exists && $wppb_showAdminBar[$key] == 'show') echo ' checked';echo'/><font size="1">'; _e('Show', 'profilebuilder'); echo'</font><span style="padding-left:20px"></span>
    								<input type="radio" name="wppb_display_admin_settings['.$key.']" value="hide"';if ($setting_exists && $wppb_showAdminBar[$key] == 'hide') echo ' checked';echo'/><font size="1">'; _e('Hide', 'profilebuilder'); echo'</font>
    							</td>
    						</tr>';
    				}
    				?>
    
    	</table>
    
    	<div align="right">
    		<input type="hidden" name="action" value="update" />
    		<p class="submit">
    		<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
    		</p>
    	</div>
    	</form>
    
    <?php
    }

    @barinagabriel if you want to give me the Pro version, I wouldn’t say no 😉

    Plugin Contributor barinagabriel

    (@barinagabriel)

    Hello,

    I have tried out the fix suggested by @maximinime, and I must admit it is a very elegant solution, so thank you for that!

    I will do some final testing, and I will issue an update with this fix; regarding your “suggestion”, I must let my colleague Adrian decide.

    Regards,
    Gabriel

    Plugin Contributor barinagabriel

    (@barinagabriel)

    @maximinime,

    I have talked it over with Adrian, and we can offer you a nice discount for your troubles.

    Please contact me via email (since I can’t contact you directly) at gabriel@cozmoslabs.com.

    Please make sure to include a link to this thread, or let me know about it in the email, since I get quite a few every day. Thanks!

    Gabriel

    maximinime

    (@maximinime)

    @barinagabriel I noticed this broke again for me in pro version 1.3.1, and I could not see the admin bar in the front end at all.

    It seems you were addressing an issue where, if a user was in a role set to hide the admin bar, being in another role that had it set to show wouldn’t make it reappear. I have provided a corrected function so that being in any role that explicitly shows the admin bar, makes sure it will always show:

    function wppb_show_admin_bar($content){
    	global $current_user;
    
    	$adminSettingsPresent = get_option('wppb_display_admin_settings','not_found');
    	$show = null;
    
    	if ($adminSettingsPresent != 'not_found' && $current_user->ID)
    		foreach ($current_user->roles as $role_key) {
    			if (empty($GLOBALS['wp_roles']->roles[$role_key]))
    				continue;
    			$role = $GLOBALS['wp_roles']->roles[$role_key];
    			if (isset($adminSettingsPresent[$role['name']])) {
    				if ($adminSettingsPresent[$role['name']] == 'show')
    					$show = true;
    				if ($adminSettingsPresent[$role['name']] == 'hide' && $show === null)
    					$show = false;
    			}
    		}
    	return $show === null ? $content : $show;
    }
Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘break admin bar’ is closed to new replies.