Skip to:
Content
Pages
Categories
Search
Top
Bottom

Wants to rename "notification" tab


  • sundev
    Participant

    @sundev

    Hello everyone, I can’t get “notification tab” to change. Below is the code used, am I missing something? thank in anticipation.

    function mb_profile_menu_tabs(){
    $bp->bp_nav[‘notifications’][‘name’] = sprintf(‘Alerts<span>%d</span>’,notifications_get_total_notification_count());
    }
    add_action(‘bp_setup_nav’, ‘mb_profile_menu_tabs’, 201);

Viewing 3 replies - 1 through 3 (of 3 total)

  • sundev
    Participant

    @sundev

    Any help or suggestion is appreciated.


    modemlooper
    Moderator

    @modemlooper

    BP 1.9+

    function custom_notification_menu_tabs(){
    	global $bp;
    	if ( bp_is_user() && bp_user_has_access() ) {
    		$count    = bp_notifications_get_unread_notification_count( bp_displayed_user_id() );
    		$class    = ( 0 === $count ) ? 'no-count' : 'count';
    		$bp->bp_nav['notifications']['name'] = sprintf( __( 'Alerts <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), number_format_i18n( $count ) );
    	} 
    
    }
    add_action('bp_setup_nav', 'custom_notification_menu_tabs', 201);

    sundev
    Participant

    @sundev

    @modemlooper

    // I got it working by putting these lines of your code on my existing function

    if ( bp_is_user() && bp_user_has_access() ) {
    $count = bp_notifications_get_unread_notification_count( bp_displayed_user_id() );
    $class = ( 0 === $count ) ? ‘no-count’ : ‘count’;
    $bp->bp_nav[‘notifications’][‘name’] = sprintf( __( ‘Alerts <span class=”%s”>%s</span>’, ‘buddypress’ ), esc_attr( $class ), number_format_i18n( $count ) );
    }

    I really appreciate your gesture. Thank you very much.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wants to rename "notification" tab’ is closed to new replies.
Skip to toolbar