[wp-trac] [WordPress Trac] #21352: wp_lostpassword_url() on multisite

WordPress Trac noreply at wordpress.org
Tue Oct 28 18:01:24 UTC 2014


#21352: wp_lostpassword_url() on multisite
------------------------------------+-----------------------------
 Reporter:  philly max              |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Login and Registration  |     Version:  3.3
 Severity:  normal                  |  Resolution:
 Keywords:  needs-patch             |     Focuses:  multisite
------------------------------------+-----------------------------

Comment (by Tree2054):

 Replying to [comment:22 landshark]:
 > Pardon my ignorance, but were do I insert this code to fix the problem?
 >

 You would need to add it in your own plugin somewhere

 >
 >
 > Replying to [comment:21 Tree2054]:
 > > Replying to [comment:20 foodin65]:
 > > > I'm having this issue on my multi-site network now. It's very
 confusing for users on my sub-site (which is a membership site) to click
 the lost password link and then get an email with the main site's name and
 domain. It's also links them back to the main site to reset their email.
 Then the "success" please login form... logs them into the main site and
 not the sub site they are trying to reset their password form.
 > > >
 > > > How do we change this?
 > >
 > > I'm using the following filter on `network_site_url` and it seems to
 give the functionality that you are describing.
 > >
 > > https://gist.github.com/Trii/32498eb95b13caf66d69
 > >
 > >
 > > {{{
 > > #!php
 > > <?php
 > > // rewrite "network" URLs to site_url except for URLs that truly need
 it
 > > add_filter( 'network_site_url', function($url, $path = '', $scheme =
 null ) {
 > >         // Normalize path in case people pass in a leading /
 > >         $path = ltrim( $path, '/' );
 > >
 > >         // According to my pal grep, a call to `network_site_url` with
 no path
 > >         // means they are intentionally linking to the main network
 site.
 > >         // Specific requests for the network admin interface should
 also
 > >         // remain the same
 > >         if ( !$path || strpos( $path, 'wp-admin/network' ) === 0 ) {
 > >             return $url;
 > >         }
 > >
 > >         return site_url($path, $scheme);
 > > });
 > > ?>
 > > }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/21352#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list