Title: break admin bar
Last modified: August 20, 2016

---

# break admin bar

 *  [albertorrent](https://wordpress.org/support/users/albertorrent/)
 * (@albertorrent)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/)
 * i deactivate all plugins and with twenty the admin bar is not showning in frondend
 * [http://wordpress.org/extend/plugins/profile-builder/](http://wordpress.org/extend/plugins/profile-builder/)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/break-admin-bar/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/break-admin-bar/page/2/?output_format=md)

 *  Thread Starter [albertorrent](https://wordpress.org/support/users/albertorrent/)
 * (@albertorrent)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310404)
 * how i can deactivate the function of the admin bar?
 *  Thread Starter [albertorrent](https://wordpress.org/support/users/albertorrent/)
 * (@albertorrent)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310554)
 * 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/](http://postimage.org/image/chx4exqxj/)
 *  Plugin Contributor [barinagabriel](https://wordpress.org/support/users/barinagabriel/)
 * (@barinagabriel)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310587)
 * 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
 *  Thread Starter [albertorrent](https://wordpress.org/support/users/albertorrent/)
 * (@albertorrent)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310588)
 * 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](https://wordpress.org/support/users/barinagabriel/)
 * (@barinagabriel)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310595)
 * 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
 *  Thread Starter [albertorrent](https://wordpress.org/support/users/albertorrent/)
 * (@albertorrent)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310598)
 * I installed PB in a clean and new WordPress 3.5, and with only installed PB still
   doesn’t work.
 *  Thread Starter [albertorrent](https://wordpress.org/support/users/albertorrent/)
 * (@albertorrent)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310599)
 * Can you test it?
 *  Plugin Contributor [barinagabriel](https://wordpress.org/support/users/barinagabriel/)
 * (@barinagabriel)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310600)
 * Hello,
 * are you the same person who posted on Cozmoslabs about this?
 *  Thread Starter [albertorrent](https://wordpress.org/support/users/albertorrent/)
 * (@albertorrent)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310601)
 * 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](https://wordpress.org/support/users/barinagabriel/)
 * (@barinagabriel)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310604)
 * 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](https://wordpress.org/support/topic/break-admin-bar/gabriel@cozmoslabs.com?output_format=md)
   along with a link to this thread and I will take look as soon as I get a little
   spare time.
 * Regards,
    Gabriel
 *  Thread Starter [albertorrent](https://wordpress.org/support/users/albertorrent/)
 * (@albertorrent)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310605)
 * Email send!
 *  [maximinime](https://wordpress.org/support/users/maximinime/)
 * (@maximinime)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310609)
 * 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](https://wordpress.org/support/users/barinagabriel/) if you want
   to give me the Pro version, I wouldn’t say no 😉
 *  Plugin Contributor [barinagabriel](https://wordpress.org/support/users/barinagabriel/)
 * (@barinagabriel)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310610)
 * Hello,
 * I have tried out the fix suggested by [@maximinime](https://wordpress.org/support/users/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](https://wordpress.org/support/users/barinagabriel/)
 * (@barinagabriel)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310611)
 * [@maximinime](https://wordpress.org/support/users/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](https://wordpress.org/support/topic/break-admin-bar/gabriel@cozmoslabs.com?output_format=md).
 * 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](https://wordpress.org/support/users/maximinime/)
 * (@maximinime)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/break-admin-bar/#post-3310651)
 * [@barinagabriel](https://wordpress.org/support/users/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)

1 [2](https://wordpress.org/support/topic/break-admin-bar/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/break-admin-bar/page/2/?output_format=md)

The topic ‘break admin bar’ is closed to new replies.

 * ![](https://ps.w.org/profile-builder/assets/icon-256x256.png?rev=2961144)
 * [User Profile Builder - Beautiful User Registration Forms, User Profiles & User Role Editor](https://wordpress.org/plugins/profile-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/profile-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/profile-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/profile-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/profile-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/profile-builder/reviews/)

 * 16 replies
 * 3 participants
 * Last reply from: [barinagabriel](https://wordpress.org/support/users/barinagabriel/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/break-admin-bar/page/2/#post-3310656)
 * Status: not resolved