how to redirect to a custom password retrieval page

I have a new site and I’m using bbpress beta-3 with it, I’ve created custom login/register/lost-password pages with the custom templates supplied with bbpress and I can’t seem to find the filter/hook/action that “hijacks” the calls to wp-login.php. My biggest problem is with the lost-password page, I want to redirect with a notice, I can catch the error but I can’t catch the sent password event.

I’m now using in function.php:

Read More
function get_password_retrieve_errors(){
    wp_redirect( site_url('lost-password').'?getpass=failed'  );
}

add_filter('lostpassword_redirect', 'get_password_retrieve_errors', 1);

and in form-user-lost-pass.php:

<?php if ( $_GET['getpass'] == 'failed' ) { ?>
    <div class="bbp-template-notice error">
        <p>Invalid username or e-mail, please try again.</p>
    </div>
<?php } ?>
  1. Is there a way to do it?
  2. Is there a global $error object which I can always refer to?
  3. Is there a global $notifications object I can always refer to?

Thanks!

Related posts

Leave a Reply

1 comment

  1. not sure i really follow you either, BUT what about filtering the wp_lostpassword_url

    from wp-includes/general-template.php

    function wp_lostpassword_url( $redirect = '' ) {
                $args = array( 'action' => 'lostpassword' );
                if ( !empty($redirect) ) {
                        $args['redirect_to'] = $redirect;
                }
    
                $lostpassword_url = add_query_arg( $args, network_site_url('wp-login.php', 'login') );
                return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect );
    }
    

    looks like it has a filter you could use to point it to your custom URL, and even add your ‘getpass’ query var

    Here’s a very basic example:

    function custom_login_lostpassword_url()
    {
        // use a site_url/plugins_url to output the correct URL.
        return "http://.../my-custom-lostpassword-screen.php";
    }
    
    add_filter("lostpassword_url", "custom_login_lostpassword_url");