This tip will help you in setting up different sidebars based on a user's login status.
Follow below steps to achieve this :
a. Go to WPLMS Options panel -> Sidebar manager and create some new sidebars . Note we'll use this sidebar for logged in user in "Course directory" page.
For our demo we created a sidebar called : "example"
b. Now, go to WP Admin -> Plugins -> Editor -> WPLMS Customizer -> customizer_class.php
c. Add the following code in _construct function :
add_filter('wplms_sidebar',array($this,'custom_course_sidebar_for_loggedin_users'));
d. Add the following code in class:
function custom_course_sidebar_for_loggedin_users($sidebar){ if(bp_is_page( BP_COURSE_SLUG )){ // Detects if we're on BuddyPress Course pages. if(is_user_logged_in()){ // Checks if user is logged in. $sidebar = 'example'; } } return $sidebar; }
e. Save file.
Now we have two sidebars for the All Course Page or course directory, one shows for non-logged in users and other shows for logged in users.