BP_Messages_Component::setup_admin_bar( array $wp_admin_nav = array() )
Set up the Toolbar.
Description
Parameters
- $wp_admin_nav
-
(Optional) See {BP_Component::setup_admin_bar()} for details.
Default value: array()
Source
File: bp-messages/classes/class-bp-messages-component.php
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | 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. $messages_link = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ); // Unread message count. $count = messages_get_unread_count( bp_loggedin_user_id() ); if ( ! empty ( $count ) ) { $title = sprintf( /* translators: %s: Unread message count for the current user */ __( 'Messages %s' , 'buddyboss' ), '<span class="count">' . bp_core_number_format( $count ) . '</span>' ); $inbox = sprintf( /* translators: %s: Unread message count for the current user */ __( 'Messages %s' , 'buddyboss' ), '<span class="count">' . bp_core_number_format( $count ) . '</span>' ); } else { $title = __( 'Messages' , 'buddyboss' ); $inbox = __( 'Messages' , 'buddyboss' ); } // Add main Messages menu. $wp_admin_nav [] = array ( 'parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this ->id, 'title' => $title , 'href' => $messages_link ); // Inbox. $wp_admin_nav [] = array ( 'parent' => 'my-account-' . $this ->id, 'id' => 'my-account-' . $this ->id . '-inbox' , 'title' => $inbox , 'href' => $messages_link , 'position' => 10 ); // Compose Message. $wp_admin_nav [] = array ( 'parent' => 'my-account-' . $this ->id, 'id' => 'my-account-' . $this ->id . '-compose' , 'title' => __( 'New Message' , 'buddyboss' ), 'href' => trailingslashit( $messages_link . 'compose' ), 'position' => 30 ); // Site Wide Notices. if ( bp_current_user_can( 'bp_moderate' ) ) { $wp_admin_nav [] = array ( 'parent' => 'my-account-' . $this ->id, 'id' => 'my-account-' . $this ->id . '-notices' , 'title' => __( 'Site Notices' , 'buddyboss' ), 'href' => trailingslashit( $messages_link . 'notices' ), 'position' => 90 ); } } parent::setup_admin_bar( $wp_admin_nav ); } |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.