PluginProbe
Loginizer / trunk
Loginizer vtrunk
2.1.1 2.1.0 2.0.9 2.0.8 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 All 75 releases
← All changes | main/social-base.php +16 -7 2.0.1 → trunk View file →
@@ -20,8 +20,18 @@
20 20 clean_user_cache($user->ID);
21 21 wp_clear_auth_cookie();
22 22
23 23 do_action('authenticate', $user, $user->user_login, '');
24 +
25 + // If the user has enabled limit concurrent sessions
26 + if(defined('LOGINIZER_PRO_VERSION')){
27 + $limit_session = apply_filters('loginizer_pro_limit_sessions', $user);
28 + if(!empty($limit_session) && is_wp_error($limit_session)){
29 + self::$error['concurrent_logins'] = $limit_session->get_error_message();
30 + return false;
31 + }
32 + }
33 +
24 34 wp_set_current_user($user->ID, $user->user_login);
25 35 wp_set_auth_cookie($user->ID, true, is_ssl());
26 36 do_action('wp_login', $user->user_login, $user);
27 37 update_user_caches($user);
@@ -84,8 +94,11 @@
84 94 }
85 95
86 96 update_user_option($user_id, 'default_password_nag', true, true); // This will show alert to user to change the password.
87 97 $user = get_user_by('ID', $user_id);
98 +
99 + // Following the default WordPress registration flow, we will notify user about the creation of new account.
100 + do_action('register_new_user', $user_id);
88 101
89 102 // Save avatar if possible.
90 103 $tried_to_download = get_user_meta($user->ID, 'loginizer_avatar_download', true);
91 104 if(!empty($data['photoURL']) && !empty($loginizer['social_settings']['general']['save_avatar']) && empty($tried_to_download)){
@@ -111,8 +124,9 @@
111 124 protected static function close_tab(){
112 125 global $loginizer;
113 126
114 127 // Check if the URL is safe to use.
128 + $redirect_to = '';
115 129 if(!empty(self::$ref)){
116 130 $redirect_to = self::handle_redirect(self::$ref);
117 131 }
118 132
@@ -278,11 +292,10 @@
278 292 }
279 293
280 294 protected static function handle_redirect($url){
281 295
282 - $redirect = '';
283 296 if(empty($url)){
284 - return $redirect;
297 + return '';
285 298 }
286 299
287 300 $url = rawurldecode($url);
288 301 $parsed_url = parse_url($url);
@@ -297,13 +310,9 @@
297 310 }
298 311
299 312 // Reloading the page wont show the admin page so we need to redirect it to the admin page.
300 313 if($parsed_url['scheme'].'://'.$parsed_url['host'] . $parsed_url['path'] == wp_login_url()){
301 - return $redirect;
302 - }
303 -
304 - if(strpos(wp_login_url(), $parsed_url['path']) !== FALSE){
305 - return $redirect;
314 + return admin_url();
306 315 }
307 316
308 317 // If none of the above happens then we will just make the page reload.
309 318 return $url;