Skip to:
Content

BuddyPress.org

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#474 closed enhancement (fixed)

site-wide option site-admin->buddypress

Reported by: frumph's profile Frumph Owned by:
Milestone: Priority: major
Severity: Version:
Component: Keywords:
Cc:

Description

Need a site-wide option for turning off the admin bar completely so it doesn't show at all, ever.

Change History (7)

#1 @apeatling
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

This is quite easy to do. Create a file called bp-custom.php and place it in the mu-plugins folder.

Add this code:

remove_action( 'wp_footer', 'bp_core_admin_bar' );

#2 @Frumph
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Created file:

bp-custom.php in the mu-plugins folder.

added:
<?php
remove_action( 'wp_footer', 'bp_core_admin_bar' );
?>

.. the bar still there.

#3 @apeatling
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

My mistake:

remove_action( 'wp_footer', 'bp_core_admin_bar', 8 );
remove_action( 'wp_head', 'bp_core_admin_bar_css' );

Use the latest trunk. I've tested this and it works.

#4 @apeatling
15 years ago

I should also note, by doing this you are disabling access to the notifications for users. It's generally not a good idea unless you are going to reproduce the content somewhere else.

#5 follow-up: @Frumph
15 years ago

Sidebar code replacement:

		<?php if ( is_user_logged_in() &&  $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id )) { ?>
			<?php global $bp; ?>
			<li>
				<ul>
					<h2>Notifications (<span><?php echo count($notifications) ?></span>)</h2>
					<?php $counter = 0; ?>
					<?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
						<?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
						<li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
						<?php $counter++; ?>
					<?php } ?>						
				</ul>
			</li>
		<?php } ?>

#6 in reply to: ↑ 5 @Frumph
15 years ago

Replying to Frumph:
sorry fixed, had to move global $bp *before* the get_notifications

Sidebar code replacement:

		<?php global $bp; if ( is_user_logged_in() &&  $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id )) { ?>
			<li>
				<ul>
					<h2>Notifications (<span><?php echo count($notifications) ?></span>)</h2>
					<?php $counter = 0; ?>
					<?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
						<?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
						<li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
						<?php $counter++; ?>
					<?php } ?>						
				</ul>
			</li>
		<?php } ?>

#7 @lancewillett
15 years ago

Note: as of r1270 you can now disable the admin bar like this (in your wp-config file:

define('BP_DISABLE_ADMIN_BAR', true);

Note: See TracTickets for help on using tickets.