This tip allows you to put restrictions on who all can access the course directory.
Below is code tip , so you need the WPLMS Customizer plugin installed in your WPLMS setup .
Here's how you can do it:
1. Go to WP Admin -> Plugins -> Editor -> WPLMS Customizer
2. Locate File customizer_class.php
3. Add the below line in the function public function __construct()
PHP Code:
add_action('bp_before_directory_course_page',array($this,'redirect_if_not_loggedin'));
4. Now, add the function redirect_if_not_loggedin just before the function activate:
PHP Code:
function redirect_if_not_loggedin(){
if(!is_user_logged_in()){
$location = get_site_url(); // Change this location to a static url where you want to redirect the user to.
echo '<script type="text/javascript">
<!--
window.location= "'. $location .'";
//-->
</script>';
exit();
}
}
/**
* Activate the plugin
*/
public static function activate()