Skip to:
Content

BuddyPress.org

Changeset 9261


Ignore:
Timestamp:
12/23/2014 11:11:58 AM (7 years ago)
Author:
djpaul
Message:

Core: adjust bp_modify_page_title() so that it can be used safely after the wp_head action.

The function is used to set the value for the page's <title> element, but it currently throws a PHP Notice if it's used after the wp_head action is triggered.
This is because bp_core_sort_subnav_items() (hooked to wp_head) re-keys the global $bp->bp_options_nav array; the keys are changed from strings to integers representing the desired order of the menu items.

Fixes #6077

File:
1 edited

Legend:

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

    r9249 r9261  
    466466
    467467        // Append action name if we're on a member component sub-page
    468         if ( ! empty( $bp->bp_options_nav[ $component_id ][ bp_current_action() ]['name'] ) && ! empty( $bp->canonical_stack['action'] ) ) {
    469             $component_subnav_name = "{$bp->bp_options_nav[ $component_id ][ bp_current_action() ]['name']}";
     468        if ( ! empty( $bp->bp_options_nav[ $component_id ] ) && ! empty( $bp->canonical_stack['action'] ) ) {
     469            $component_subnav_name = wp_filter_object_list( $bp->bp_options_nav[ $component_id ], array( 'slug' => bp_current_action() ), 'and', 'name' );
     470
     471            if ( $component_subnav_name ) {
     472                $component_subnav_name = array_shift( $component_subnav_name );
     473            } else {
     474                $component_subnav_name = '';
     475            }
     476
    470477        } else {
    471478            $component_subnav_name = '';
Note: See TracChangeset for help on using the changeset viewer.