How can I restrict access to some pages?

Home Forums Legacy Support Support queries How-to & Troubleshooting How can I restrict access to some pages?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #124651
    Galedie
    Participant
    Hi, I would like to restrict access to every course page and to the forums. If a non-logged in user click on the link, it would redirect them to the login page. Thank you
    #124725
    H.K. Latiyan
    Participant
    Hi, You can try using the site lock feature in this case, as you do not want the non logged in users to see the courses, refer: https://vibethemes.com/documentation/wplms/knowledge-base/site-lock-in-wplms/  
    #124768
    Galedie
    Participant
    Hi, I still want the visitors to be able to visit every other page of the website.
    #124890
    H.K. Latiyan
    Participant
    Hi, Well there is no such setting for this, but for restricting the users from forums, you can create all the forums as private. For courses is it only the single course page that you want to hide ? If yes then I can give you a custom code to redirect non logged in users to homepage when accessing the single course page . Let me know if you want it.
    #124922
    Galedie
    Participant
    Hi, I will set them as private then, thank you. I would like the single course to be hidden, as the page with all-courses. Thank you  
    #124962
    H.K. Latiyan
    Participant
    Hi, Do you want to redirect single course page to all courses page for non logged in users  ?  
    #124979
    Galedie
    Participant
    Hi, I don't want non logged in users to be able to access all courses page and single course page.
    #125073
    H.K. Latiyan
    Participant
    Hi, Add the bellow code in your wplms-customizer.php file present in your wplms customizer plugin: add_action('template_redirect',function(){   if( !is_user_logged_in() && (bp_current_component() == 'course' || is_singular('course')) ){     wp_redirect(home_url());     exit();   } },1);   This will redirect non logged in users to the homepage when they try to access the all courses page or the single course page.
    #125114
    Galedie
    Participant
    Hi, thank you very much. It works. :)
Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘How can I restrict access to some pages?’ is closed to new replies.