array( 'name' => _x( 'Favorites', 'Profile activity screen sub nav', 'buddypress' ), 'slug' => 'favorites', 'parent_slug' => $slug, 'screen_function' => 'bp_activity_screen_favorites', 'position' => 30, 'item_css_id' => 'activity-favs', 'generate' => bp_activity_can_favorite(), ); // Additional menu if friends is active. if ( bp_is_active( 'friends' ) ) { $sub_nav[] = array( 'name' => _x( 'Friends', 'Profile activity screen sub nav', 'buddypress' ), 'slug' => bp_get_friends_slug(), 'parent_slug' => $slug, 'screen_function' => 'bp_activity_screen_friends', 'position' => 40, 'item_css_id' => 'activity-friends', ); } // Additional menu if groups is active. if ( bp_is_active( 'groups' ) ) { $sub_nav[] = array( 'name' => _x( 'Groups', 'Profile activity screen sub nav', 'buddypress' ), 'slug' => bp_get_groups_slug(), 'parent_slug' => $slug, 'screen_function' => 'bp_activity_screen_groups', 'position' => 50, 'item_css_id' => 'activity-groups' ); } parent::register_nav( $main_nav, $sub_nav ); } /** * Set up the component entries in the WordPress Admin Bar. * * @since 1.5.0 * * @see BP_Component::setup_nav() for a description of the $wp_admin_nav * parameter array. * * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a * description. */ public function setup_admin_bar( $wp_admin_nav = array() ) { // Menus for logged in user. if ( is_user_logged_in() ) { // Setup the logged in user variables. $activity_slug = bp_get_activity_slug(); // Unread message count. if ( bp_activity_do_mentions() ) { $count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() ); if ( ! empty( $count ) ) { $title = sprintf( /* translators: %s: Unread mention count for the current user */ _x( 'Mentions %s', 'Toolbar Mention logged in user', 'buddypress' ), '' . bp_core_number_format( $count ) . '' ); } else { $title = _x( 'Mentions', 'Toolbar Mention logged in user', 'buddypress' ); } } // Add the "Activity" sub menu. $wp_admin_nav[] = array( 'parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => _x( 'Activity', 'My Account Activity sub nav', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $activity_slug ) ) ), ); // Personal. $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-personal', 'title' => _x( 'Personal', 'My Account Activity sub nav', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $activity_slug, 'just-me' ) ) ), 'position' => 10, ); // Mentions. if ( bp_activity_do_mentions() ) { $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-mentions', 'title' => $title, 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $activity_slug, 'mentions' ) ) ), 'position' => 20, ); } // Favorite activity items. if ( bp_activity_can_favorite() ) { $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorites', 'title' => _x( 'Favorites', 'My Account Activity sub nav', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $activity_slug, 'favorites' ) ) ), 'position' => 30, ); } // Friends? if ( bp_is_active( 'friends' ) ) { $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-friends', 'title' => _x( 'Friends', 'My Account Activity sub nav', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $activity_slug, bp_get_friends_slug() ) ) ), 'position' => 40, ); } // Groups? if ( bp_is_active( 'groups' ) ) { $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-groups', 'title' => _x( 'Groups', 'My Account Activity sub nav', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $activity_slug, bp_get_groups_slug() ) ) ), 'position' => 50 ); } } parent::setup_admin_bar( $wp_admin_nav ); } /** * Set up the title for pages and