daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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' );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top