0. Install the WPLMS Customizer plugin.

1. Go to WP Admin -> Plugins -> Editor -> WPLMS Customizer -> customizer_class.php
2. Add following code in the _construct function:

PHP Code:

 

add_filter('bp_core_get_user_domain',array($this,'mycustom_bp_core_get_user_domain'),1,4);  

 

3. Add following code in the class :

PHP Code:

 

function mycustom_bp_core_get_user_domain($domain, $user_id, $user_nicename, $user_login){
            if(is_singular('course') && !current_user_can('edit_posts'))
                return '#';

            return $domain;
        }  

 

By adding this : !current_user_can('edit_posts') in the if condition, the link is removed only for students and not for Instructors or admins.