membership_redirect_to_protected

The Membership 2 membership redirect to protected function.

Description

membership_redirect_to_protected(); 

Usage

  1. if ( !function_exists( 'membership_redirect_to_protected' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'membership-2/app_old/membershipincludes/includes/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = membership_redirect_to_protected(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/app_old/membershipincludes/includes/functions.php  
  1. function membership_redirect_to_protected() { 
  2.  
  3. global $M_options; 
  4.  
  5. if(defined('MEMBERSHIP_GLOBAL_TABLES') && MEMBERSHIP_GLOBAL_TABLES === true ) { 
  6. if(function_exists('switch_to_blog')) { 
  7. switch_to_blog(MEMBERSHIP_GLOBAL_MAINSITE); 
  8.  
  9. $url = get_permalink( (int) $M_options['nocontent_page'] ); 
  10. $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 
  11.  
  12. if($url != $current_url) { 
  13. wp_safe_redirect( $url ); 
  14. exit; 
  15.