Buddypress new navigation output on user profile pages per user role


I currently am outputting the following code which creates a new navigation item to appear on a Buddypress profile page (relating to this previous support request https://premium.wpmudev.org/forums/topic/schedule-calendar-on-the-buddypress-user-profile-page#post-316479)

function my_setup_nav() {

bp_core_new_nav_item( array(

‘name’ => __( ‘Book a Lesson’ ),

‘slug’ => ‘Lessons’,

‘screen_function’ => ‘lesson_function’,

‘position’ => 40 ) );


This works well, I am wondering is it possible to modify this code further to limit the navigation item to only appear on certain user roles?

At the moment it appears on every user that is registered on the site. I would like to only show up on for certain user roles.

Many thanks