Title: dr00bie's Replies | WordPress.org

---

# dr00bie

  [  ](https://wordpress.org/support/users/dr00bie/)

 *   [Profile](https://wordpress.org/support/users/dr00bie/)
 *   [Topics Started](https://wordpress.org/support/users/dr00bie/topics/)
 *   [Replies Created](https://wordpress.org/support/users/dr00bie/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/dr00bie/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/dr00bie/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/dr00bie/engagements/)
 *   [Favorites](https://wordpress.org/support/users/dr00bie/favorites/)

 Search replies:

## Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Next Active Directory Integration] After SSO redirect fix, can no longer use the Sign in with SSO link](https://wordpress.org/support/topic/after-sso-redirect-fix-can-no-longer-use-the-sign-in-with-sso-link/)
 *  Thread Starter [dr00bie](https://wordpress.org/support/users/dr00bie/)
 * (@dr00bie)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/after-sso-redirect-fix-can-no-longer-use-the-sign-in-with-sso-link/#post-8419972)
 * Update: it is working great now — so well that we cannot log out of WordPress
   without automatically being logged right back in! Thanks a lot for all of your
   help so far!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Next Active Directory Integration] After SSO redirect fix, can no longer use the Sign in with SSO link](https://wordpress.org/support/topic/after-sso-redirect-fix-can-no-longer-use-the-sign-in-with-sso-link/)
 *  Thread Starter [dr00bie](https://wordpress.org/support/users/dr00bie/)
 * (@dr00bie)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/after-sso-redirect-fix-can-no-longer-use-the-sign-in-with-sso-link/#post-8419450)
 * That appears to work. This code is a bit different than the code I was using 
   as referenced in the forum post. I was using this,
 * [code]
    protected function loginUser($user, $exit = true) { // ADI-418: Accessing
   un-protected URLs directly with SSO enabled redirect does not work $redirectTo
   = (isset($_SERVER['REDIRECT_URL']) && !empty($_SERVER['REDIRECT_URL'])) ? $_SERVER['
   REDIRECT_URL'] : null; // default redirect if WordPress forces itself a login,
   e.g. when accessing /wp-admin $redirectTo = (!empty($_REQUEST['redirect_to']))?
   $_REQUEST['redirect_to'] : $redirectTo; // if not set, fall back to the home 
   url $redirectTo = empty($redirectTo) ? home_url('/') : $redirectTo;
 *  do_action('wp_login', $user->user_login, $user);
    wp_set_current_user($user-
   >ID); } [/code]
 * So, I was missing the,
 * [code]
    $secure_cookie = is_ssl(); wp_set_current_user($user->ID, $user->user_login);
   wp_set_auth_cookie($user->ID, true, $secure_cookie); [/code]
 * That may have been the cause of the weirdness I was seeing with SSO link?
 * Thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Next Active Directory Integration] Change Redirect after SSO?](https://wordpress.org/support/topic/change-redirect-after-sso/)
 *  Thread Starter [dr00bie](https://wordpress.org/support/users/dr00bie/)
 * (@dr00bie)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/change-redirect-after-sso/#post-8406530)
 * One more followup. Now when I click the Sign in with SSO link on the WordPress
   login box, it just simply refreshes the page and does nothing. I reverted my 
   changes back to the default,
 * [code]
    protected function loginUser($user, $exit = true) { $redirectTo = (!empty(
   $_REQUEST['redirect_to'])) ? $_REQUEST['redirect_to'] : home_url('/'); do_action('
   wp_login', $user->user_login, $user); wp_set_current_user($user->ID); wp_set_auth_cookie(
   $user->ID); wp_safe_redirect($redirectTo);
 *  if ($exit) {
    exit; } } [/code]
 * And it works now. But now my redirect is not working again.
 * Thanks!
    Drew
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Next Active Directory Integration] Change Redirect after SSO?](https://wordpress.org/support/topic/change-redirect-after-sso/)
 *  Thread Starter [dr00bie](https://wordpress.org/support/users/dr00bie/)
 * (@dr00bie)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/change-redirect-after-sso/#post-8396649)
 * I was able to make the required changes to my plugin and it works like a dream
   now! Thanks for that!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Next Active Directory Integration] Authentication is successful, but no data is returned](https://wordpress.org/support/topic/authentication-is-successful-but-no-data-is-returned/)
 *  Thread Starter [dr00bie](https://wordpress.org/support/users/dr00bie/)
 * (@dr00bie)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/authentication-is-successful-but-no-data-is-returned/#post-8328708)
 * Thanks, I appreciate the reply.
 * I thought it was a configuration thing on my end, not a plugin error. I appreciate
   the push in the right direction and I will get with our admin and see if I can
   get the Base DN right.
 * Thanks!
    Drew

Viewing 5 replies - 1 through 5 (of 5 total)