function userpro_redirects() { global $pagenow; // redirect dashboard if ('index.php' == $pagenow && is_admin()) { if (userpro_is_logged_in() && userpro_allow_dashboard_redirect()) { wp_safe_redirect(userpro_dashboard_redirect_uri()); exit; } } // redirect dashboard profile if ('profile.php' == $pagenow) { if (userpro_is_logged_in() && userpro_allow_profile_redirect()) { wp_safe_redirect(userpro_profile_redirect_uri()); exit; } } // redirect login if ('wp-login.php' == $pagenow && !isset($_REQUEST['action'])) { if (!userpro_is_logged_in() && isset($_REQUEST['userpro_panic_key']) && userpro_get_option('userpro_panic_key') && $_REQUEST['userpro_panic_key'] == userpro_get_option('userpro_panic_key')) { return true; } if (userpro_allow_login_redirect()) { if (isset($_GET['redirect_to'])) { $url = add_query_arg('redirect_to', urlencode(esc_url($_GET['redirect_to'])), esc_url(userpro_login_redirect_uri())); } else { $url = userpro_login_redirect_uri(); } wp_safe_redirect($url); exit; } } // redirect lostpassword if ('wp-login.php' == $pagenow && isset($_REQUEST['action']) && $_REQUEST['action'] == 'lostpassword') { if (userpro_allow_login_redirect()) { wp_safe_redirect(userpro_login_redirect_uri()); exit; } } // redirect register if ('wp-login.php' == $pagenow && isset($_REQUEST['action']) && $_REQUEST['action'] == 'register') { if (userpro_allow_register_redirect()) { wp_safe_redirect(userpro_register_redirect_uri()); exit; } } }
function userpro_redirects() { global $pagenow; // redirect dashboard if ('index.php' == $pagenow && is_admin()) { if (userpro_is_logged_in() && userpro_allow_dashboard_redirect()) { wp_redirect(userpro_dashboard_redirect_uri()); exit; } } // redirect dashboard profile if ('profile.php' == $pagenow) { if (userpro_is_logged_in() && userpro_allow_profile_redirect()) { wp_redirect(userpro_profile_redirect_uri()); exit; } } // redirect login if ('wp-login.php' == $pagenow && !isset($_REQUEST['action'])) { if (userpro_allow_login_redirect()) { if (isset($_GET['redirect_to'])) { $url = add_query_arg('redirect_to', $_GET['redirect_to'], userpro_login_redirect_uri()); } else { $url = userpro_login_redirect_uri(); } wp_redirect($url); exit; } } // redirect lostpassword if ('wp-login.php' == $pagenow && isset($_REQUEST['action']) && $_REQUEST['action'] == 'lostpassword') { if (userpro_allow_login_redirect()) { wp_redirect(userpro_login_redirect_uri()); exit; } } // redirect register if ('wp-login.php' == $pagenow && isset($_REQUEST['action']) && $_REQUEST['action'] == 'register') { if (userpro_allow_register_redirect()) { wp_redirect(userpro_register_redirect_uri()); exit; } } }