Guest User

Untitled

a guest
Dec 13th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2. /**
  3. * Restrict Page By Member Type.
  4. */
  5. function yzc_restrict_page_by_member_type() {
  6.  
  7. if ( ! function_exists( 'bp_get_member_type' ) ) {
  8. return;
  9. }
  10.  
  11. // Get Data
  12. $member_type = bp_get_member_type( bp_loggedin_user_id() );
  13.  
  14. if ( is_page( 'rider-search-geobp' ) && 'drivers' != $member_type ) {
  15. wp_safe_redirect( home_url() );
  16. exit;
  17. }
  18.  
  19. }
  20.  
  21. add_action( 'template_redirect', 'yzc_restrict_page_by_member_type' );
Add Comment
Please, Sign In to add comment