//Sucess $user_data = get_userdata ($user_id); if ($user_data !== false) { //Setup Cookie wp_clear_auth_cookie(); wp_set_auth_cookie ($user_data->ID, true); do_action('wp_login', $user_data->user_login, $user_data); //Where did the user come from? $oa_social_login_source = (!empty ($_REQUEST ['oa_social_login_source']) ? strtolower (trim ($_REQUEST ['oa_social_login_source'])) : ''); //Use safe redirection? $redirect_to_safe = false; //Build the url to redirect the user to switch ($oa_social_login_source) { //*************** Registration *************** case 'registration': //Default redirection $redirect_to = admin_url (); //Redirection customized if (isset ($settings ['plugin_registration_form_redirect'])) { switch (strtolower ($settings ['plugin_registration_form_redirect'])) { //Homepage case 'homepage': $redirect_to = home_url (); break; //Custom case 'custom': if (isset ($settings ['plugin_registration_form_redirect_custom_url']) AND strlen (trim ($settings ['plugin_registration_form_redirect_custom_url'])) > 0) { $redirect_to = trim ($settings ['plugin_registration_form_redirect_custom_url']); } break; //Default/Dashboard default: case 'dashboard': $redirect_to = admin_url (); break; } } break; //*************** Login *************** case 'login': //Default redirection $redirect_to = wp_login_url(); //Redirection in URL if (!empty ($_GET ['redirect_to'])) { $redirect_to = $_GET ['redirect_to']; $redirect_to_safe = true; } else { //Redirection customized if (isset ($settings ['plugin_login_form_redirect'])) { switch (strtolower ($settings ['plugin_login_form_redirect'])) { //Dashboard case 'dashboard': $redirect_to = admin_url (); break; //Custom case 'custom': if (isset ($settings ['plugin_login_form_redirect_custom_url']) AND strlen (trim ($settings ['plugin_login_form_redirect_custom_url'])) > 0) { $redirect_to = trim ($settings ['plugin_login_form_redirect_custom_url']); } break; //Default/Homepage default: case 'homepage': $redirect_to = home_url (); break; } } } break; // *************** Comments *************** case 'comments': $redirect_to = oa_social_login_get_current_url () . '#comments'; break; //*************** Widget/Shortcode *************** default: case 'widget': case 'shortcode': // This is a new user $opt_key = ($new_registration === true ? 'register' : 'login'); //Default value $redirect_to = oa_social_login_get_current_url (); //Redirection customized if (isset ($settings['plugin_shortcode_' . $opt_key . '_redirect'])) { switch (strtolower ($settings['plugin_shortcode_' . $opt_key . '_redirect'])) { //Current case 'current': $redirect_to = oa_social_login_get_current_url (); break; //Homepage case 'homepage': $redirect_to = home_url (); break; //Dashboard case 'dashboard': $redirect_to = admin_url (); break; //Custom case 'custom': if (isset ($settings['plugin_shortcode_' . $opt_key . '_redirect_url']) AND strlen (trim ($settings['plugin_shortcode_' . $opt_key . '_redirect_url'])) > 0) { $redirect_to = trim ($settings['plugin_shortcode_' . $opt_key . '_redirect_url']); } break; } } break; } //Check if url set if (!isset ($redirect_to) OR strlen (trim ($redirect_to)) == 0) { $redirect_to = home_url (); } //Use safe redirection if ($redirect_to_safe === true) { wp_safe_redirect ($redirect_to); } else { wp_redirect ($redirect_to); } exit (); }
open the file oa-social-login.php of the Social Login plugin and replace this line: add_action ('init', 'oa_social_login_init', 2000); With the following line: add_action ('init', 'oa_social_login_init', 50);
There are currently 1 users browsing this thread. (0 members and 1 guests)