Skip to:
Content

BuddyPress.org

Changeset 5211


Ignore:
Timestamp:
10/06/2011 02:41:17 PM (13 years ago)
Author:
boonebgorges
Message:

Updates user admin bar menu for right-floating compatibility in WP 3.3. See #3596

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-members/bp-members-adminbar.php

    r4961 r5211  
    1616 *
    1717 * @since BuddyPress (r4151)
     18 * @todo Deprecate WP 3.2 admin bar compatibility when we drop 3.2 support
    1819 */
    1920function bp_members_admin_bar_my_account_menu() {
    20     global $bp, $wp_admin_bar;
     21    global $bp, $wp_admin_bar, $wp_version;
    2122
    2223    // Bail if this is an ajax request
     
    3536        ) );
    3637
    37         // Unique ID for the 'My Account' menu
    38         $bp->my_account_menu_id = ( ! empty( $avatar ) ) ? 'my-account-with-avatar' : 'my-account';
     38        // Some admin bar setup in WP 3.2 differs from WP 3.3+.
     39        // Backward-compatibility will be deprecated at some point.
     40        if ( version_compare( (float)$wp_version, '3.3', '>=' ) ) {
     41            // Stored in the global so we can add menus easily later on
     42            $bp->my_account_menu_id = 'my-account';
     43
     44            $title = bp_get_loggedin_user_fullname() . $avatar;
     45
     46            $class = 'opposite';
     47            if ( !empty( $avatar ) )
     48                $class .= ' with-avatar';
     49
     50            $meta  = array(
     51                'class' => $class
     52            );
     53        } else {
     54            $bp->my_account_menu_id = ( ! empty( $avatar ) ) ? 'my-account-with-avatar' : 'my-account';
     55            $title = $avatar . bp_get_loggedin_user_fullname();
     56            $meta  = array();
     57        }
    3958
    4059        // Create the main 'My Account' menu
    4160        $wp_admin_bar->add_menu( array(
    4261            'id'    => $bp->my_account_menu_id,
    43             'title' => $avatar . bp_get_loggedin_user_fullname(),
    44             'href'  => $bp->loggedin_user->domain
     62            'title' => $title,
     63            'href'  => $bp->loggedin_user->domain,
     64            'meta'  => $meta
    4565        ) );
    4666
Note: See TracChangeset for help on using the changeset viewer.