| 176 | | 'name' => _x( 'Personal', 'Profile activity screen sub nav', 'buddypress' ), |
| 177 | | 'slug' => 'just-me', |
| 178 | | 'parent_url' => $activity_link, |
| 179 | | 'parent_slug' => $slug, |
| 180 | | 'screen_function' => 'bp_activity_screen_my_activity', |
| 181 | | 'position' => 10 |
| | 177 | 'name' => _x( 'Personal', 'Profile activity screen sub nav', 'buddypress' ), |
| | 178 | 'slug' => 'just-me', |
| | 179 | 'parent_url' => $activity_link, |
| | 180 | 'parent_slug' => $slug, |
| | 181 | 'screen_function' => 'bp_activity_screen_my_activity', |
| | 182 | 'position' => 10, |
| | 183 | 'show_in_admin_bar' => true, |
| 187 | | 'name' => _x( 'Mentions', 'Profile activity screen sub nav', 'buddypress' ), |
| 188 | | 'slug' => 'mentions', |
| 189 | | 'parent_url' => $activity_link, |
| 190 | | 'parent_slug' => $slug, |
| 191 | | 'screen_function' => 'bp_activity_screen_mentions', |
| 192 | | 'position' => 20, |
| 193 | | 'item_css_id' => 'activity-mentions' |
| | 189 | 'name' => _x( 'Mentions', 'Profile activity screen sub nav', 'buddypress' ), |
| | 190 | 'slug' => 'mentions', |
| | 191 | 'parent_url' => $activity_link, |
| | 192 | 'parent_slug' => $slug, |
| | 193 | 'screen_function' => 'bp_activity_screen_mentions', |
| | 194 | 'position' => 20, |
| | 195 | 'item_css_id' => 'activity-mentions', |
| | 196 | 'show_in_admin_bar' => true, |
| 200 | | 'name' => _x( 'Favorites', 'Profile activity screen sub nav', 'buddypress' ), |
| 201 | | 'slug' => 'favorites', |
| 202 | | 'parent_url' => $activity_link, |
| 203 | | 'parent_slug' => $slug, |
| 204 | | 'screen_function' => 'bp_activity_screen_favorites', |
| 205 | | 'position' => 30, |
| 206 | | 'item_css_id' => 'activity-favs' |
| | 203 | 'name' => _x( 'Favorites', 'Profile activity screen sub nav', 'buddypress' ), |
| | 204 | 'slug' => 'favorites', |
| | 205 | 'parent_url' => $activity_link, |
| | 206 | 'parent_slug' => $slug, |
| | 207 | 'screen_function' => 'bp_activity_screen_favorites', |
| | 208 | 'position' => 30, |
| | 209 | 'item_css_id' => 'activity-favs', |
| | 210 | 'show_in_admin_bar' => true, |
| 213 | | 'name' => _x( 'Friends', 'Profile activity screen sub nav', 'buddypress' ), |
| 214 | | 'slug' => bp_get_friends_slug(), |
| 215 | | 'parent_url' => $activity_link, |
| 216 | | 'parent_slug' => $slug, |
| 217 | | 'screen_function' => 'bp_activity_screen_friends', |
| 218 | | 'position' => 40, |
| 219 | | 'item_css_id' => 'activity-friends' |
| | 217 | 'name' => _x( 'Friends', 'Profile activity screen sub nav', 'buddypress' ), |
| | 218 | 'slug' => bp_get_friends_slug(), |
| | 219 | 'parent_url' => $activity_link, |
| | 220 | 'parent_slug' => $slug, |
| | 221 | 'screen_function' => 'bp_activity_screen_friends', |
| | 222 | 'position' => 40, |
| | 223 | 'item_css_id' => 'activity-friends', |
| | 224 | 'show_in_admin_bar' => true, |
| 226 | | 'name' => _x( 'Groups', 'Profile activity screen sub nav', 'buddypress' ), |
| 227 | | 'slug' => bp_get_groups_slug(), |
| 228 | | 'parent_url' => $activity_link, |
| 229 | | 'parent_slug' => $slug, |
| 230 | | 'screen_function' => 'bp_activity_screen_groups', |
| 231 | | 'position' => 50, |
| 232 | | 'item_css_id' => 'activity-groups' |
| | 231 | 'name' => _x( 'Groups', 'Profile activity screen sub nav', 'buddypress' ), |
| | 232 | 'slug' => bp_get_groups_slug(), |
| | 233 | 'parent_url' => $activity_link, |
| | 234 | 'parent_slug' => $slug, |
| | 235 | 'screen_function' => 'bp_activity_screen_groups', |
| | 236 | 'position' => 50, |
| | 237 | 'item_css_id' => 'activity-groups', |
| | 238 | 'show_in_admin_bar' => true, |
| 258 | | // Unread message count. |
| 259 | | if ( bp_activity_do_mentions() ) { |
| 260 | | $count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() ); |
| 261 | | if ( !empty( $count ) ) { |
| 262 | | $title = sprintf( |
| 263 | | /* translators: %s: Unread mention count for the current user */ |
| 264 | | _x( 'Mentions %s', 'Toolbar Mention logged in user', 'buddypress' ), |
| 265 | | '<span class="count">' . bp_core_number_format( $count ) . '</span>' |
| | 266 | if ( isset( $bp->members->nav ) ) { |
| | 267 | $nav = $bp->members->nav->get_admin_nav( array( |
| | 268 | 'parent_slug' => bp_get_activity_slug(), |
| | 269 | ) ); |
| | 270 | |
| | 271 | if ( ! empty( $nav['parent'] ) ) { |
| | 272 | // Add the "Activity" sub menu. |
| | 273 | $wp_admin_nav[] = array( |
| | 274 | 'parent' => buddypress()->my_account_menu_id, |
| | 275 | 'id' => 'my-account-' . $this->id, |
| | 276 | 'title' => _x( 'Activity', 'My Account Activity sub nav', 'buddypress' ), |
| | 277 | 'href' => $activity_link |
| 270 | | } |
| 271 | | |
| 272 | | // Add the "Activity" sub menu. |
| 273 | | $wp_admin_nav[] = array( |
| 274 | | 'parent' => buddypress()->my_account_menu_id, |
| 275 | | 'id' => 'my-account-' . $this->id, |
| 276 | | 'title' => _x( 'Activity', 'My Account Activity sub nav', 'buddypress' ), |
| 277 | | 'href' => $activity_link |
| 278 | | ); |
| 279 | | |
| 280 | | // Personal. |
| 281 | | $wp_admin_nav[] = array( |
| 282 | | 'parent' => 'my-account-' . $this->id, |
| 283 | | 'id' => 'my-account-' . $this->id . '-personal', |
| 284 | | 'title' => _x( 'Personal', 'My Account Activity sub nav', 'buddypress' ), |
| 285 | | 'href' => $activity_link, |
| 286 | | 'position' => 10 |
| 287 | | ); |
| 289 | | // Mentions. |
| 290 | | if ( bp_activity_do_mentions() ) { |
| 291 | | $wp_admin_nav[] = array( |
| 292 | | 'parent' => 'my-account-' . $this->id, |
| 293 | | 'id' => 'my-account-' . $this->id . '-mentions', |
| 294 | | 'title' => $title, |
| 295 | | 'href' => trailingslashit( $activity_link . 'mentions' ), |
| 296 | | 'position' => 20 |
| 297 | | ); |
| 298 | | } |
| 299 | | |
| 300 | | // Favorite activity items. |
| 301 | | if ( bp_activity_can_favorite() ) { |
| 302 | | $wp_admin_nav[] = array( |
| 303 | | 'parent' => 'my-account-' . $this->id, |
| 304 | | 'id' => 'my-account-' . $this->id . '-favorites', |
| 305 | | 'title' => _x( 'Favorites', 'My Account Activity sub nav', 'buddypress' ), |
| 306 | | 'href' => trailingslashit( $activity_link . 'favorites' ), |
| 307 | | 'position' => 30 |
| 308 | | ); |
| 309 | | } |
| 310 | | |
| 311 | | // Friends? |
| 312 | | if ( bp_is_active( 'friends' ) ) { |
| 313 | | $wp_admin_nav[] = array( |
| 314 | | 'parent' => 'my-account-' . $this->id, |
| 315 | | 'id' => 'my-account-' . $this->id . '-friends', |
| 316 | | 'title' => _x( 'Friends', 'My Account Activity sub nav', 'buddypress' ), |
| 317 | | 'href' => trailingslashit( $activity_link . bp_get_friends_slug() ), |
| 318 | | 'position' => 40 |
| 319 | | ); |
| 320 | | } |
| 321 | | |
| 322 | | // Groups? |
| 323 | | if ( bp_is_active( 'groups' ) ) { |
| 324 | | $wp_admin_nav[] = array( |
| 325 | | 'parent' => 'my-account-' . $this->id, |
| 326 | | 'id' => 'my-account-' . $this->id . '-groups', |
| 327 | | 'title' => _x( 'Groups', 'My Account Activity sub nav', 'buddypress' ), |
| 328 | | 'href' => trailingslashit( $activity_link . bp_get_groups_slug() ), |
| 329 | | 'position' => 50 |
| 330 | | ); |
| | 281 | if ( ! empty( $nav['children'] ) ) { |
| | 282 | foreach ( $nav['children'] as $sub_nav ) { |
| | 283 | // Sub nav title defaults to its name. |
| | 284 | $sub_nav_title = $sub_nav->name; |
| | 285 | |
| | 286 | if ( isset( $nav['parent']->default_subnav_slug ) && $sub_nav->slug !== $nav['parent']->default_subnav_slug ) { |
| | 287 | $sub_nav_link = trailingslashit( $activity_link . $sub_nav->slug ); |
| | 288 | $sub_nav_id = sprintf( 'my-account-%s-%s', $this->id, $sub_nav->slug ); |
| | 289 | } elseif ( isset( $nav['parent']->default_subnav_slug ) && $sub_nav->slug === $nav['parent']->default_subnav_slug ) { |
| | 290 | $sub_nav_id = sprintf( 'my-account-%s-personal', $this->id ); |
| | 291 | $sub_nav_link = $activity_link; |
| | 292 | } |
| | 293 | |
| | 294 | // Checking for unread mentions |
| | 295 | if ( 'mentions' === $sub_nav->slug && bp_activity_do_mentions() ) { |
| | 296 | $count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() ); |
| | 297 | if ( ! empty( $count ) ) { |
| | 298 | $sub_nav_title = sprintf( |
| | 299 | /* translators: %s: Unread mention count for the current user */ |
| | 300 | _x( 'Mentions %s', 'Toolbar Mention logged in user', 'buddypress' ), |
| | 301 | '<span class="count">' . bp_core_number_format( $count ) . '</span>' |
| | 302 | ); |
| | 303 | } |
| | 304 | } |
| | 305 | |
| | 306 | // Add the sub nav items |
| | 307 | $wp_admin_nav[] = array( |
| | 308 | 'parent' => 'my-account-' . $this->id, |
| | 309 | 'id' => $sub_nav_id, |
| | 310 | 'title' => $sub_nav_title, |
| | 311 | 'href' => $sub_nav_link, |
| | 312 | 'position' => $sub_nav->position, |
| | 313 | ); |
| | 314 | } |
| | 315 | } |