Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hiding Profile Tabs (i.e. Activity) Based on User Role


  • rygramer
    Participant

    @rygramer

    Hi all, I am trying to make certain Profile tabs (i.e. “Activity”) hidden for ALL users except for those assigned specific roles (i.e. Administrators). Any ideas?

    Here is the context of my question:

    • A user will create an extended profile and be assigned the role of “subscriber”
    • Several other users with the roles of “administrator” will ‘mention’ the subscriber in a forum that only the administrators will have access to
    • These mentions will populate on the subscriber’s profile under “Activity -> Mentions”
    • The subscriber (or all other subscribers for that matter) must not see these mentions, but the administrators should

    I am not quite sure if I am headed down the right path. Thanks for any advice!

    WordPress 4.3
    bbPress 2.5.8
    BuddyPress Version 2.3.3
    Farben Basic theme
    (currently working from a local server, so cannot share link)

Viewing 1 replies (of 1 total)

  • danbp
    Moderator

    @danbp

    hi,

    first snipppet removes the mention tab.
    Second remove the mention item from the top right usermenu below howdy.

    Condition is set to site admin. If you use custom capabilities, change that to your need.
    Code goes to bp-custom.php

    function bpfr_hide_mention_nav() {
    	//if ( bp_current_user_can( 'bp_moderate' ) )
    	if ( is_super_admin() ) {
    		return;
    	} 
    	bp_core_remove_subnav_item( 'activity', 'mentions' ); 
    }
    add_action( 'bp_ready', 'bpfr_hide_mention_nav' );
    
    function bpfr_admin_bar_remove_activity_mentions(){
    global $wp_admin_bar;
    	if ( is_super_admin() ) {
    		return;
    	}
    	$wp_admin_bar->remove_node('my-account-activity-mentions');
    }
    add_action('wp_before_admin_bar_render','bpfr_admin_bar_remove_activity_mentions');
    

    An alternate (IMO better) solution, is this premium plugin: http://www.philopress.com/products/buddynotes/

Viewing 1 replies (of 1 total)
  • The topic ‘Hiding Profile Tabs (i.e. Activity) Based on User Role’ is closed to new replies.
Skip to toolbar