Skip to:
Content

BuddyPress.org

Changeset 8579


Ignore:
Timestamp:
07/09/2014 08:35:58 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Updates to bp_use_wp_admin_bar():

  • Default to true
  • Use BP_USE_WP_ADMIN_BAR constant as true/false.
  • Use bp_force_buddybar() rather than accessing the option directly.

See #5390.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r8571 r8579  
    316316 * @uses apply_filters() Filter 'bp_use_wp_admin_bar' to alter.
    317317 *
    318  * @return bool False when WP Toolbar support is disabled, true when enabled.
    319  *        Default: true.
     318 * @return bool Default: true. False when WP Toolbar support is disabled.
    320319 */
    321320function bp_use_wp_admin_bar() {
     321
     322    // Default to true (to avoid loading deprecated BuddyBar code)
    322323    $use_admin_bar = true;
    323324
    324     // Has the WP Toolbar constant been explicity set?
    325     if ( defined( 'BP_USE_WP_ADMIN_BAR' ) && ! BP_USE_WP_ADMIN_BAR )
     325    // Has the WP Toolbar constant been explicity opted into?
     326    if ( defined( 'BP_USE_WP_ADMIN_BAR' ) ) {
     327        $use_admin_bar = (bool) BP_USE_WP_ADMIN_BAR;
     328
     329    // ...or is the old BuddyBar being forced back into use?
     330    } elseif ( bp_force_buddybar( false ) ) {
    326331        $use_admin_bar = false;
    327 
    328     // Has the admin chosen to use the BuddyBar during an upgrade?
    329     elseif ( (bool) bp_get_option( '_bp_force_buddybar', false ) )
    330         $use_admin_bar = false;
    331 
    332     return apply_filters( 'bp_use_wp_admin_bar', $use_admin_bar );
     332    }
     333
     334    return (bool) apply_filters( 'bp_use_wp_admin_bar', $use_admin_bar );
    333335}
    334336
Note: See TracChangeset for help on using the changeset viewer.