Show custom bp nav menu item for instructor only on his profile

Please add the given code in your wplms-cutomizer.php file in wplms-customizer plugin :

add_action( 'bp_setup_nav', 'create_lesson_setup_nav');
function create_lesson_setup_nav(){
global $bp;
if( current_user_can('edit_posts')){
 bp_core_new_nav_item( array(
'name' => __('Lesson Planner', 'Vibe' ),
'slug' => 'lesson-planner',
'position' => 100,
'screen_function' => 'wplms_create_lesson_planner_redirect',
'show_for_displayed_user' => false
) );   
}

}
function wplms_create_lesson_planner_redirect(){
wp_redirect('http://scholars.thehistorytutor.com/lesson-planner','301');
exit;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *