| 448 | | $title = bp_get_displayed_user_fullname(); |
| | 448 | // Get the component's ID to try and get its name |
| | 449 | $component_id = $component_name = bp_current_component(); |
| | 450 | |
| | 451 | // Use the component nav name |
| | 452 | if ( ! empty( $bp->bp_nav[$component_id] ) ) { |
| | 453 | $span = strpos( $bp->bp_nav[$component_id]['name'], '<span' ); |
| | 454 | if ( false !== $span ) { |
| | 455 | $component_name = substr( $bp->bp_nav[$component_id]['name'], 0, $span ); |
| | 456 | |
| | 457 | } else { |
| | 458 | $component_name = $bp->bp_nav[$component_id]['name']; |
| | 459 | } |
| | 460 | |
| | 461 | // Fall back on the component ID |
| | 462 | } elseif ( ! empty( $bp->{$component_id}->id ) ) { |
| | 463 | $component_name = $bp->{$component_id}->id; |
| | 464 | } |
| | 465 | |
| | 466 | // Append action name if we're on a member component sub-page |
| | 467 | if ( ! empty( $bp->bp_options_nav[$component_id][bp_current_action()]['name'] ) && ! empty( $bp->canonical_stack['action'] ) ) { |
| | 468 | $component_name .= " {$sep} {$bp->bp_options_nav[bp_current_component()][bp_current_action()]['name']} "; |
| | 469 | } |
| | 470 | |
| | 471 | // If on the user profile's landing page, just use the fullname |
| | 472 | if ( bp_is_current_component( $bp->default_component ) && bp_get_requested_url() === bp_displayed_user_domain() ) { |
| | 473 | $title = bp_get_displayed_user_fullname(); |
| | 474 | |
| | 475 | // translators: construct the page title. 1 = user name, 2 = component name, 3 = seperator |
| | 476 | } else { |
| | 477 | $title = strip_tags( sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), ucwords( $component_name ), $sep ) ); |
| | 478 | } |