Changeset 3374724
- Timestamp:
- 10/08/2025 12:13:05 AM (6 months ago)
- Location:
- simple-membership-after-login-redirection/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
swpm-after-login-redirection.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-membership-after-login-redirection/trunk/readme.txt
r3271703 r3374724 5 5 Requires at least: 4.5 6 6 Tested up to: 6.8 7 Stable tag: 1.97 Stable tag: 2.0 8 8 License: GPLv2 or later 9 9 … … 32 32 33 33 == Changelog == 34 35 = 2.0 = 36 * Support added for the [Social Login Addon](https://simple-membership-plugin.com/simple-membership-social-login-addon/) - now the after login redirection will also work when the member logs in using social login. 34 37 35 38 = 1.9 = -
simple-membership-after-login-redirection/trunk/swpm-after-login-redirection.php
r3229099 r3374724 2 2 /* 3 3 Plugin Name: Simple Membership After Login Redirection 4 Version: 1.94 Version: 2.0 5 5 Plugin URI: https://simple-membership-plugin.com/ 6 6 Author: smp7, wp.insider … … 13 13 } 14 14 15 define( 'SWPM_ALR_VERSION', ' 1.9' );15 define( 'SWPM_ALR_VERSION', '2.0' ); 16 16 define( 'SWPM_ALR_CONTEXT', 'swpm_alr'); 17 17 … … 21 21 add_filter('swpm_after_login_url', 'swpm_alr_after_login_url'); 22 22 add_filter('swpm_get_login_link_url', 'swpm_alr_append_query_arg_if_applicable'); 23 add_filter('swpm_sl_after_login_redirect_url', 'swpm_alr_do_after_social_login_redirection', 10, 2); 23 24 24 25 // The following 6 filters are used to allow the usage of the swpm_redirect_to parameter, if it is currently present in the page's URL … … 129 130 } 130 131 132 function swpm_alr_do_after_social_login_redirection($redirect_to, $auth_data){ 133 if (method_exists('SWPM_SL_Utils', 'log_simple_debug')) { 134 SWPM_SL_Utils::log_simple_debug("After login redirection addon. Checking if member need to be redirected.", true); 135 } 136 137 $swpm_member = SwpmMemberUtils::get_user_by_email($auth_data->email); 138 139 if (empty($auth_data->referer_url)) { 140 return $redirect_to; 141 } 142 143 //First check if a the swpm_redirect_to argument is set (meaning the user needs to be redirected to the last page). 144 $query_string = parse_url($auth_data->referer_url, PHP_URL_QUERY); 145 if (!empty($query_string)) { 146 parse_str($query_string, $query_params); 147 if(isset($query_params['swpm_redirect_to']) && wp_http_validate_url($query_params['swpm_redirect_to'])){ 148 return esc_url_raw($query_params['swpm_redirect_to']); 149 } 150 } 151 152 //Check if there is a membership level specific after login redirection 153 $level_id = $swpm_member->membership_level; 154 $key = 'swpm_alr_after_login_page_field'; 155 $after_login_page_url = SwpmMembershipLevelCustom::get_value_by_key($level_id, $key); 156 if (!empty($after_login_page_url)) { 157 //Redirect to the membership level specific after login page. 158 if (method_exists('SWPM_SL_Utils', 'log_simple_debug')) { 159 SWPM_SL_Utils::log_simple_debug("After login redirection is configured in the membership level. Redirecting to: " . $after_login_page_url, true); 160 } 161 return $after_login_page_url; 162 } 163 164 return $redirect_to; 165 } 166 131 167 function swpm_alr_after_login_url($url) { 132 168 $auth = SwpmAuth::get_instance();
Note: See TracChangeset
for help on using the changeset viewer.