Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/08/2016 05:56:22 AM (11 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-blogs/classes/class-bp-blogs-component.php

    r10544 r10555  
    238238                        // My Sites.
    239239                        $wp_admin_nav[] = array(
    240                                 'parent' => 'my-account-' . $this->id,
    241                                 'id'     => 'my-account-' . $this->id . '-my-sites',
    242                                 'title'  => __( 'My Sites', 'buddypress' ),
    243                                 'href'   => $blogs_link
     240                                'parent'   => 'my-account-' . $this->id,
     241                                'id'       => 'my-account-' . $this->id . '-my-sites',
     242                                'title'    => __( 'My Sites', 'buddypress' ),
     243                                'href'     => $blogs_link,
     244                                'position' => 10
    244245                        );
    245246
     
    247248                        if ( bp_blog_signup_enabled() ) {
    248249                                $wp_admin_nav[] = array(
    249                                         'parent' => 'my-account-' . $this->id,
    250                                         'id'     => 'my-account-' . $this->id . '-create',
    251                                         'title'  => __( 'Create a Site', 'buddypress' ),
    252                                         'href'   => trailingslashit( bp_get_blogs_directory_permalink() . 'create' )
     250                                        'parent'   => 'my-account-' . $this->id,
     251                                        'id'       => 'my-account-' . $this->id . '-create',
     252                                        'title'    => __( 'Create a Site', 'buddypress' ),
     253                                        'href'     => trailingslashit( bp_get_blogs_directory_permalink() . 'create' ),
     254                                        'position' => 99
    253255                                );
    254256                        }
Note: See TracChangeset for help on using the changeset viewer.