pmpro_login_head

The Paid Memberships Pro pmpro login head function.

Description

pmpro_login_head(); 

Usage

  1. if ( !function_exists( 'pmpro_login_head' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/login.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_login_head(); 
  7.  

Defined (1)

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

/includes/login.php  
  1. function pmpro_login_head() 
  2. {  
  3. $login_redirect = apply_filters("pmpro_login_redirect", true); 
  4.  
  5. if((pmpro_is_login_page() || is_page("login") || 
  6. class_exists("Theme_My_Login") && defined('Theme_My_Login::version') && version_compare(Theme_My_Login::version, "6.3") >= 0 && (Theme_My_Login::is_tml_page("register") || Theme_My_Login::is_tml_page("login")) 
  7. && $login_redirect 
  8. //redirect registration page to levels page 
  9. if( isset($_REQUEST['action']) && $_REQUEST['action'] == "register" ||  
  10. isset($_REQUEST['registration']) && $_REQUEST['registration'] == "disabled" || 
  11. !is_admin() && class_exists("Theme_My_Login") && defined('Theme_My_Login::version') && version_compare(Theme_My_Login::version, "6.3") >= 0 && Theme_My_Login::is_tml_page("register")  
  12. //redirect to levels page unless filter is set. 
  13. $link = apply_filters("pmpro_register_redirect", pmpro_url("levels"));  
  14. if(!empty($link)) 
  15. wp_redirect($link); 
  16. exit; 
  17. else 
  18. return; //don't redirect if pmpro_register_redirect filter returns false or a blank URL 
  19.  
  20. //if theme my login is installed, redirect all logins to the login page 
  21. if(pmpro_is_plugin_active("theme-my-login/theme-my-login.php")) 
  22. //check for the login page id and redirect there if we're not there already 
  23. global $post; 
  24.  
  25. if(!empty($GLOBALS['theme_my_login']) && is_array($GLOBALS['theme_my_login']->options)) 
  26. //an olderversionof TML stores it this way 
  27. if($GLOBALS['theme_my_login']->options['page_id'] !== $post->ID) 
  28. //redirect to the real login page 
  29. $link = get_permalink($GLOBALS['theme_my_login']->options['page_id']); 
  30. if($_SERVER['QUERY_STRING']) 
  31. $link .= "?" . $_SERVER['QUERY_STRING']; 
  32. wp_redirect($link); 
  33. exit; 
  34. elseif(!empty($GLOBALS['theme_my_login']->options)) 
  35. //another olderversionof TML stores it this way 
  36. if($GLOBALS['theme_my_login']->options->options['page_id'] !== $post->ID) 
  37. //redirect to the real login page 
  38. $link = get_permalink($GLOBALS['theme_my_login']->options->options['page_id']); 
  39. if($_SERVER['QUERY_STRING']) 
  40. $link .= "?" . $_SERVER['QUERY_STRING']; 
  41. wp_redirect($link); 
  42. exit; 
  43. elseif(class_exists("Theme_My_Login") && defined('Theme_My_Login::version') && version_compare(Theme_My_Login::version, "6.3") >= 0) 
  44. //TML > 6.3 
  45. $link = Theme_My_Login::get_page_link("login"); 
  46. if(!empty($link)) 
  47. //redirect if !is_page(), i.e. we're on wp-login.php 
  48. if(!Theme_My_Login::is_tml_page()) 
  49. wp_redirect($link); 
  50. exit; 
  51. }  
  52.  
  53. //make sure users are only getting to the profile when logged in 
  54. global $current_user; 
  55. if(!empty($_REQUEST['action']) && $_REQUEST['action'] == "profile" && !$current_user->ID) 
  56. $link = get_permalink($GLOBALS['theme_my_login']->options->options['page_id']);  
  57. wp_redirect($link); 
  58. exit;