Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How to customize the user navigation bar and user profile tabs


newbie999
Participant

@newbie999

Thank you. After searching the forums for how to check the current user’s role, I added below to function.php and it’s working. Since I’m new to this, I’m very open to suggestions if there’s a better way to write this function.

function my_alter_bp_sidebar_login(){

global $bp;

$user = new WP_User( $bp->loggedin_user->id );

if ( !empty( $user->roles ) && is_array( $user->roles ) ) {

foreach ( $user->roles as $role )

if ($role != ‘subscriber’) {

echo ‘root_domain . ‘/wp-admin/”>Dashboard<p/>’;

}

}

}

add_action(‘bp_before_sidebar_me’,’my_alter_bp_sidebar_login’,1);

Skip to toolbar