stop non-logged in user in accessing the cart and check out page?

Home Forums Chit Chat WPLMS customizations stop non-logged in user in accessing the cart and check out page?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #12439
    thorne13
    Spectator
      Hi, I would like to ask how can I stop non-logged in user  in accessing the cart  and check out page? I don't know the equivalent of the code <span style="color: #dd1144; font-family: Monaco, MonacoRegular, 'Courier New', monospace; white-space: pre;">'bp_before_directory_course_page' </span>if i will use it in the cart and checkout page. Should I use <span style="color: #dd1144; font-family: Monaco, MonacoRegular, 'Courier New', monospace; white-space: pre;">'bp_before_cart_page'</span>?   I have used the command below in stopping non logged in user to access the course page and it worked <span class="crayon-e" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important; color: teal !important;">add_action</span><span class="crayon-sy" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important;">(</span><span class="crayon-s" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important; color: #dd1144 !important;">'bp_before_directory_course_page'</span><span class="crayon-sy" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important;">,</span><span class="crayon-t" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important; font-weight: bold !important; color: #800080 !important;">array</span><span class="crayon-sy" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important;">(</span><span class="crayon-v" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important; color: #002d7a !important;">$this</span><span class="crayon-sy" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important;">,</span><span class="crayon-s" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important; color: #dd1144 !important;">'redirect_if_not_loggedin'</span><span class="crayon-sy" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important;">)</span><span class="crayon-sy" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important;">)</span><span class="crayon-sy" style="box-sizing: border-box; height: inherit; white-space: pre; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: inherit !important; line-height: inherit !important;">;</span>   Thanks!
    #12440
    thorne13
    Spectator
    Hi, I would like to ask how can I stop non-logged in user  in accessing the cart  and check out page? I don't know the equivalent of the code add_action('bp_before_directory_course_page',array($this,'redirect_if_not_loggedin')); if i will use it in the cart and checkout page. Should I use 'bp_before_cart_page' ?   I have used the command below in stopping non logged in user to access the course page and it worked add_action('bp_before_directory_course_page',array($this,'redirect_if_not_loggedin')); 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(); } }   Thanks!
    #12789
    thorne13
    Spectator
    I have found a way already using the Paid Membership Pro and the tweak given here. Just assigned the page to be accessible by the member only.
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘stop non-logged in user in accessing the cart and check out page?’ is closed to new replies.