Skip to:
Content
Pages
Categories
Search
Top
Bottom

Notificatons only for admin visible


  • nolls
    Participant

    @nolls

    Hi,
    how can I make the notification folder (unread/read) visible only for admins.
    Now its possible that user of the team (not normal user) can read pirvate messages when they click on a notification. That’s I want to prohibit.

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

  • asianowl
    Participant

    @asianowl

    here’s some clues:

    First you need to check the user’s role/capabilities and then remove the navigation menu for these users. For me, I used:

    if (current_user_can('none_admin_role')){bp_core_remove_nav_item( 'notifications');}}
    add_action( 'wp', 'bp_remove_nav_item' );

    You then still need to remove it from the admin bar. My code:

    function my_remove_admin_menu(){
    	global $wp_admin_bar;
    
    	if (current_user_can('none_admin_role'))
    	{
    		$wp_admin_bar->remove_menu('notifications');
    	}
    }
    add_action('bp_setup_admin_bar', 'my_remove_admin_menu',301);

    hopefully, this does the trick for you. I took me while to figure this out…goodluck.


    asianowl
    Participant

    @asianowl

    actually now that i think about it a little more… you should replace the current_user_can() function with the is_admin() function instead.


    nolls
    Participant

    @nolls

    Hi,
    thanks for your reply. Which file I have to edit with your code?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Notificatons only for admin visible’ is closed to new replies.
Skip to toolbar