Course news page permission

Home Forums Legacy Support Support queries How-to & Troubleshooting Course news page permission

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #144391
    hilmanf
    Spectator
    Hi, How to change course news page permission only to course student? I have set the permission on setting but not working. The news page still accessible to anyone who has direct link. Please refer this: http://prntscr.com/i5xh8s This is my setting: http://prntscr.com/i5xin3 News tab not visible to non-course student as it should. Refer: http://prntscr.com/i5xj7p But the course news page is still accessible to anyone with link. Please help. Thank you.
    #144392
    hilmanf
    Spectator
    This reply has been marked as private.
    #144599
    Anshuman Sahu
    Keymaster
    Hi, please paste the following code in wp-admin>plugins>editor>wplms customizer plugin   add_action( 'template_redirect', 'check_course_news' ); function check_course_news(){ if( !is_singular('news') ){ return; } if( !is_user_logged_in() ){ wp_redirect( home_url() ); exit(); }   $user_id = get_current_user_id();   $course_id = get_post_meta(get_the_ID(),'vibe_news_course',true); if(!empty($course_id) && is_numeric($course_id)){ $check = bp_course_is_member( $course_id,$user_id ); if(!$check){ wp_redirect( home_url() ); exit(); } } }
    #144723
    hilmanf
    Spectator
    Works like charm. Thank you!
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Course news page permission’ is closed to new replies.