public static function is_current_url_a_system_page() { $current_page_url = SwpmMiscUtils::get_current_page_url(); //Check if the current page is the membership renewal page. $renewal_url = SwpmSettings::get_instance()->get_value('renewal-page-url'); if (empty($renewal_url)) { return false; } if (SwpmMiscUtils::compare_url($renewal_url, $current_page_url)) { return true; } //Check if the current page is the membership logn page. $login_page_url = SwpmSettings::get_instance()->get_value('login-page-url'); if (empty($login_page_url)) { return false; } if (SwpmMiscUtils::compare_url($login_page_url, $current_page_url)) { return true; } //Check if the current page is the membership join page. $registration_page_url = SwpmSettings::get_instance()->get_value('registration-page-url'); if (empty($registration_page_url)) { return false; } if (SwpmMiscUtils::compare_url($registration_page_url, $current_page_url)) { return true; } return false; }
function swpm_alr_append_query_arg_if_applicable($login_url) { //Check if the redirect to last page settings is enabled. $swpm_alr_settings = get_option('swpm_alr_settings'); if (empty($swpm_alr_settings['redirect_to_last_page_enabled'])) { $swpm_alr_settings['redirect_to_last_page_enabled'] = ''; } if ($swpm_alr_settings['redirect_to_last_page_enabled'] != '1') { //The redirect to last page option is disabled. No need to add the query arg. return $login_url; } //The feature is enabled. Lets add the necessary query arg to the login url. $current_url = SwpmMiscUtils::get_current_page_url(); if (!empty($current_url)) { //Add this URL to the redirect to query arg. $current_url = urlencode($current_url); $login_url = add_query_arg('swpm_redirect_to', $current_url, $login_url); } return $login_url; }