diff --git bp-core/bp-core-buddybar.php bp-core/bp-core-buddybar.php
index 81c9f98..010824e 100644
|
|
function bp_core_new_nav_item( $args = '' ) { |
62 | 62 | if ( ( -1 != $position ) && bp_is_root_component( $slug ) && !bp_displayed_user_id() ) |
63 | 63 | return; |
64 | 64 | |
| 65 | do_action( 'bp_core_nav_default', $slug ); |
| 66 | |
| 67 | extract( $bp->bp_nav[$slug] ); |
| 68 | |
65 | 69 | // Look for current component |
66 | 70 | if ( bp_is_current_component( $slug ) && !bp_current_action() ) { |
67 | 71 | if ( !is_object( $screen_function[0] ) ) |
… |
… |
function bp_core_new_nav_item( $args = '' ) { |
78 | 82 | if ( apply_filters( 'bp_guarantee_unique_uris', true ) ) { |
79 | 83 | bp_core_redirect( bp_displayed_user_domain() . $slug . '/' . apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r ) ); |
80 | 84 | } else { |
81 | | $bp->current_action = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r ); |
| 85 | $bp->current_action = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r ); |
82 | 86 | } |
83 | 87 | } |
84 | 88 | |
… |
… |
function bp_core_new_nav_default( $args = '' ) { |
124 | 128 | $r = wp_parse_args( $args, $defaults ); |
125 | 129 | extract( $r, EXTR_SKIP ); |
126 | 130 | |
127 | | if ( $function = $bp->bp_nav[$parent_slug]['screen_function'] ) { |
128 | | if ( !is_object( $function[0] ) ) |
129 | | remove_action( 'bp_screens', $function, 3 ); |
130 | | else |
131 | | remove_action( 'bp_screens', array( &$function[0], $function[1] ), 3 ); |
132 | | } |
133 | | |
134 | | $bp->bp_nav[$parent_slug]['screen_function'] = &$screen_function; |
135 | | |
136 | | if ( $bp->current_component == $parent_slug && !$bp->current_action ) { |
137 | | if ( !is_object( $screen_function[0] ) ) |
138 | | add_action( 'bp_screens', $screen_function ); |
139 | | else |
140 | | add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ) ); |
| 131 | $bp->nav_default_resets[$parent_slug] = $r; |
| 132 | } |
141 | 133 | |
142 | | if ( $subnav_slug ) |
143 | | $bp->current_action = $subnav_slug; |
| 134 | /** |
| 135 | * Checks to see whether the subnav default has been changed by a plugin before redirecting to |
| 136 | * the default. |
| 137 | * |
| 138 | * @since 1.6 |
| 139 | * @see bp_core_new_nav_default(), where $bp->nav_default_resets is populated |
| 140 | * @see bp_core_new_nav_item(), where the bp_core_nav_default hook is located |
| 141 | * |
| 142 | * @param str $slug The parent nav slug being modified |
| 143 | */ |
| 144 | function bp_core_reset_nav_default( $slug ) { |
| 145 | global $bp; |
| 146 | |
| 147 | if ( isset( $bp->bp_nav[$slug] ) && isset( $bp->nav_default_resets[$slug] ) ) { |
| 148 | $bp->bp_nav[$slug]['screen_function'] = $bp->nav_default_resets[$slug]['screen_function']; |
| 149 | $bp->bp_nav[$slug]['default_subnav_slug'] = $bp->nav_default_resets[$slug]['subnav_slug']; |
144 | 150 | } |
145 | 151 | } |
| 152 | add_action( 'bp_core_nav_default', 'bp_core_reset_nav_default' ); |
146 | 153 | |
147 | 154 | /** |
148 | 155 | * We can only sort nav items by their position integer at a later point in time, once all |