Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/08/2016 05:56:22 AM (8 years ago)
Author:
r-a-y
Message:

BP Component: Allow plugins to set a custom position when registering an admin bar subnav menu.

This commit allows plugins to set a 'position' key when registering a WP
Admin Bar subnav menu item in the setup_admin_bar() method.

Previously, plugins had to do all sorts of array shuffling in order to
register their subnav at a preferred position. For backward compatibility,
we do some 'position' key backfilling, so if a plugin isn't using the new
'position' key, their subnav should still display at the same location.

Fixes #6859.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-friends/classes/class-bp-friends-component.php

    r10519 r10555  
    204204            // My Friends.
    205205            $wp_admin_nav[] = array(
    206                 'parent' => 'my-account-' . $this->id,
    207                 'id'     => 'my-account-' . $this->id . '-friendships',
    208                 'title'  => _x( 'Friendships', 'My Account Friends menu sub nav', 'buddypress' ),
    209                 'href'   => $friends_link
     206                'parent'   => 'my-account-' . $this->id,
     207                'id'       => 'my-account-' . $this->id . '-friendships',
     208                'title'    => _x( 'Friendships', 'My Account Friends menu sub nav', 'buddypress' ),
     209                'href'     => $friends_link,
     210                'position' => 10
    210211            );
    211212
    212213            // Requests.
    213214            $wp_admin_nav[] = array(
    214                 'parent' => 'my-account-' . $this->id,
    215                 'id'     => 'my-account-' . $this->id . '-requests',
    216                 'title'  => $pending,
    217                 'href'   => trailingslashit( $friends_link . 'requests' )
     215                'parent'   => 'my-account-' . $this->id,
     216                'id'       => 'my-account-' . $this->id . '-requests',
     217                'title'    => $pending,
     218                'href'     => trailingslashit( $friends_link . 'requests' ),
     219                'position' => 20
    218220            );
    219221        }
Note: See TracChangeset for help on using the changeset viewer.