Skip to:
Content

BuddyPress.org

Ticket #3769: 3769.02.patch

File 3769.02.patch, 2.3 KB (added by r-a-y, 13 years ago)
  • bp-core/bp-core-component.php

    class BP_Component { 
    8989         *  - id: Unique ID (for internal identification). Letters, numbers, and underscores only
    9090         *  - name: Unique name. This should be a translatable name, eg __( 'Groups', 'buddypress' )
    9191         *  - path: The file path for the component's files. Used by BP_Component::includes()
     92         *  - params: Array of additional parameters used for the component loader. Currently accepts 'adminbar_position'.
    9293         * @uses bp_Component::setup_actions() Setup the hooks and actions
    9394         */
    94         function start( $id, $name, $path ) {
     95        function start( $id, $name, $path, $params = false ) {
    9596                // Internal identifier of component
    9697                $this->id   = $id;
    9798
    class BP_Component { 
    101102                // Path for includes
    102103                $this->path = $path;
    103104
     105                // Miscellaneous component params
     106                if ( ! empty( $params ) ) {
     107                        // set the priority of the component's menu under the WP Toolbar's "My Account" menu
     108                        if ( ! empty( $params['adminbar_position'] ) && is_numeric( $params['adminbar_position'] ) )
     109                                $this->adminbar_position = $params['adminbar_position'];
     110                }
     111                // Set defaults if not passed
     112                else {
     113                        $this->adminbar_position = 10;
     114                }
     115
    104116                // Move on to the next step
    105117                $this->setup_actions();
    106118        }
    class BP_Component { 
    250262                add_action( 'bp_setup_nav',              array ( $this, 'setup_nav'              ), 10 );
    251263
    252264                // Setup WP Toolbar menus
    253                 add_action( 'bp_setup_admin_bar',        array ( $this, 'setup_admin_bar'        ), 10 );
     265                add_action( 'bp_setup_admin_bar',        array ( $this, 'setup_admin_bar'        ), $this->adminbar_position );
    254266
    255267                // Setup component title
    256268                add_action( 'bp_setup_title',            array ( $this, 'setup_title'            ), 10 );
  • bp-friends/bp-friends-loader.php

    class BP_Friends_Component extends BP_Component { 
    2222                parent::start(
    2323                        'friends',
    2424                        __( 'Friend Connections', 'buddypress' ),
    25                         BP_PLUGIN_DIR
     25                        BP_PLUGIN_DIR,
     26                        array(
     27                                'adminbar_position' => 30
     28                        )
    2629                );
    2730        }
    2831