[wp-trac] [WordPress Trac] #18743: Persistent redirect_to For Login, Registration, and Lost Password

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 22 07:04:39 UTC 2011


#18743: Persistent redirect_to For Login, Registration, and Lost Password
-------------------------+-----------------------------
 Reporter:  sparkweb     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Users        |    Version:  3.3
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 Currently, if redirect_to is passed in to the login screen and then a user
 clicks Register or Lost Password, the redirect_to gets lost. I think that
 the redirect_to should be persistent and honored whether the user logs in,
 registers or gets a lost password.

 I've written a hacky filter to do this, but I think this ought to be
 included in the core. Here's what I did:


 {{{
 //Keep redirect_to in URL
 add_filter('site_url', 'foxyshop_add_registration_redirect', 5);
 function foxyshop_add_registration_redirect($path) {
         if ((strpos($path, "action=register") !== false || strpos($path,
 "action=lostpassword") !== false) && isset($_REQUEST['redirect_to']))
 return $path . '&redirect_to='.urlencode($_REQUEST['redirect_to']);
         if (substr($path, strlen($path)-12) == "wp-login.php" &&
 isset($_REQUEST['redirect_to'])) return $path .
 '?redirect_to='.urlencode($_REQUEST['redirect_to']);
         return $path;
 }

 }}}

 (I know 3.3 is in freeze now, but there wasn't another version option)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18743>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list