Skip to:
Content

BuddyPress.org

Changeset 5126


Ignore:
Timestamp:
09/08/2011 11:34:17 AM (13 years ago)
Author:
boonebgorges
Message:

Makes BP respect show_admin_bar_front and _admin when using WP Admin Bar. Fixes #3560

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-buddybar.php

    r5119 r5126  
    525525
    526526/**
     527 * Retrieve the admin bar display preference of a user based on context.
     528 *
     529 * This is a direct copy of WP's private _get_admin_bar_pref()
     530 *
     531 * @since 1.5.0
     532 *
     533 * @param string $context Context of this preference check, either 'admin' or 'front'.
     534 * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
     535 *
     536 * @uses get_user_option()
     537 *
     538 * @return bool Whether the admin bar should be showing for this user.
     539 */
     540function bp_get_admin_bar_pref( $context, $user = 0 ) {
     541    $pref = get_user_option( "show_admin_bar_{$context}", $user );
     542    if ( false === $pref )
     543        return true;
     544
     545    return 'true' === $pref;
     546}
     547
     548/**
    527549 * Handle the Admin Bar/BuddyBar business
    528550 *
     
    551573    // Show the WordPress admin bar
    552574    if ( bp_use_wp_admin_bar() && $wp_version >= 3.1 ) {
     575        // Respect user's admin bar display preferences
     576        if ( bp_get_admin_bar_pref( 'front', bp_loggedin_user_id() ) || bp_get_admin_bar_pref( 'admin', bp_loggedin_user_id() ) )
     577            return;
     578
    553579        show_admin_bar( true );
    554580
Note: See TracChangeset for help on using the changeset viewer.