- Timestamp:
- 03/23/2023 07:35:38 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-friends/classes/class-bp-friends-component.php
r13432 r13441 162 162 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 163 163 164 // Determine user to use. 165 if ( bp_displayed_user_domain() ) { 166 $user_domain = bp_displayed_user_domain(); 167 } elseif ( bp_loggedin_user_domain() ) { 168 $user_domain = bp_loggedin_user_domain(); 169 } else { 164 // Stop if there is no user displayed or logged in. 165 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 170 166 return; 171 167 } 172 168 173 $access = bp_core_can_edit_settings(); 174 $slug = bp_get_friends_slug(); 175 $friends_link = trailingslashit( $user_domain . $slug ); 169 $access = bp_core_can_edit_settings(); 170 $slug = bp_get_friends_slug(); 176 171 177 172 // Add 'Friends' to the main navigation. … … 202 197 'name' => _x( 'Friendships', 'Friends screen sub nav', 'buddypress' ), 203 198 'slug' => 'my-friends', 204 'parent_url' => $friends_link,205 199 'parent_slug' => $slug, 206 200 'screen_function' => 'friends_screen_my_friends', … … 212 206 'name' => _x( 'Requests', 'Friends screen sub nav', 'buddypress' ), 213 207 'slug' => 'requests', 214 'parent_url' => $friends_link,215 208 'parent_slug' => $slug, 216 209 'screen_function' => 'friends_screen_requests', … … 238 231 239 232 // Setup the logged in user variables. 240 $friends_link = trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() ); 233 $friends_slug = bp_get_friends_slug(); 234 $custom_friends_slug = bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ); 241 235 242 236 // Pending friend requests. … … 263 257 'id' => 'my-account-' . $this->id, 264 258 'title' => $title, 265 'href' => $friends_link, 259 'href' => bp_loggedin_user_url( 260 array( 261 'single_item_component' => $custom_friends_slug, 262 ) 263 ), 266 264 ); 267 265 … … 271 269 'id' => 'my-account-' . $this->id . '-friendships', 272 270 'title' => _x( 'Friendships', 'My Account Friends menu sub nav', 'buddypress' ), 273 'href' => trailingslashit( $friends_link . 'my-friends' ), 271 'href' => bp_loggedin_user_url( 272 array( 273 'single_item_component' => $custom_friends_slug, 274 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_my_friends', 'my-friends' ), 275 ) 276 ), 274 277 'position' => 10, 275 278 ); … … 280 283 'id' => 'my-account-' . $this->id . '-requests', 281 284 'title' => $pending, 282 'href' => trailingslashit( $friends_link . 'requests' ), 285 'href' => bp_loggedin_user_url( 286 array( 287 'single_item_component' => $custom_friends_slug, 288 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 289 ) 290 ), 283 291 'position' => 20, 284 292 );
Note: See TracChangeset
for help on using the changeset viewer.