Skip to:
Content
Pages
Categories
Search
Top
Bottom

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


jivany
Participant

@jivany

It might be cleaner to use the current_user_can function to test. Check out the Roles info on the WP Codex, specifically the table (it makes it easy to see what roles apply):

https://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table

To make it a little cleaner you could do the following:

function my_alter_bp_sidebar_login () {
if( current_user_can( 'edit_posts' ) ) {
printf( '<a href="%s" title="Dashboard">Dashboard</a>',(get_bloginfo( 'wpurl' ).'/wp-admin/') );
}
}

This would show the link for any user who can “edit_posts” which is basically anyone other than Subscriber.

Skip to toolbar