websharks/s2member — pull request #187 by raamdev (2014-06-03 18:43:41+00:00)
Title: Use Child Site Lost Password URL instead of Parent Lost Password URL

Filter the Lost Password URL and change the default behavior of `wp_lostpassword_url()` so that it uses `site_url()` instead of `network_site_url()`, but only if the current `$_SERVER['REQUEST_URI']` differs from the Parent Site URL, as returned by `network_site_url()`.

In a non-multisite environment, the default WordPress behavior (as of v3.9.1) is used.

Also adds a new s2Member filter: `ws_plugin__s2member_lost_password_url`

Resolves websharks/s2member#138

---

@jaswsinc Note that I realized it was necessary to do more than just check if the `$_SERVER['REQUEST_URI']` was `/wp-login.php`, as sub-domain installs wouldn't match there (e.g., `/wordpress/wp-login.php`) and I can't just account for sub-domain installs, because then we'd need to consider child sites (e.g., `/wordpress/childsite/wp-login.php`).

So instead, I get the current request URL and then compare that to the output of `network_site_url()` to determine if we're looking at `wp-login.php` on a Child Site (in which case we need to change the Lost Password URL) or the Parent Site (in which case we do nothing differnet).

I've tested this on a single-site install and a multisite install and it works as expected.