Last active
December 31, 2015 02:09
-
-
Save benallfree/7918949 to your computer and use it in GitHub Desktop.
Patches nextend FB to use login_redirect filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: nextend-facebook-connect.php | |
=================================================================== | |
--- nextend-facebook-connect.php (revision 819180) | |
+++ nextend-facebook-connect.php (working copy) | |
@@ -132,13 +132,13 @@ | |
AND type = \'fb\'', $user_info->ID)); | |
set_site_transient($user_info->ID.'_new_fb_admin_notice',__('Your Facebook profile is successfully unlinked from your account.', 'nextend-facebook-connect'), 3600); | |
} | |
- new_fb_redirect(); | |
+ new_fb_redirect($user_info); | |
} | |
require_once (dirname(__FILE__) . '/sdk/init.php'); | |
$user = $facebook->getUser(); | |
if ($user && is_user_logged_in() && new_fb_is_user_connected()) { | |
- new_fb_redirect(); | |
+ new_fb_redirect($user); | |
} elseif ($user) { | |
// Register or Login | |
@@ -247,7 +247,7 @@ | |
set_site_transient($user_info->ID.'_new_fb_admin_notice',__('This Facebook profile is already linked with other account. Linking process failed!', 'nextend-facebook-connect'), 3600); | |
} | |
} | |
- new_fb_redirect(); | |
+ new_fb_redirect($user_info); | |
} | |
catch(FacebookApiException $e) { | |
echo 'Caught exception: ', $e->getMessage() , "\n"; | |
@@ -462,7 +462,7 @@ | |
return site_url('wp-login.php') . '?loginFacebook=1'; | |
} | |
-function new_fb_redirect() { | |
+function new_fb_redirect($user) { | |
$redirect = get_site_transient( nextend_uniqid().'_fb_r'); | |
@@ -473,7 +473,9 @@ | |
$redirect = site_url(); | |
} | |
} | |
- header('LOCATION: ' . $redirect); | |
+ | |
+ $redirect = apply_filters('login_redirect', $redirect, $redirect, $user); | |
+ wp_safe_redirect($redirect); | |
delete_site_transient( nextend_uniqid().'_fb_r'); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment