Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

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!

share|improve this question
    
I'm not completely sure I'm following. Are you trying to create a custom page that allows the user to reset their password? Or redirect them to a custom page when their password fails (is incorrect) when logging in? –  Pippin Jul 14 '11 at 4:04
add comment

1 Answer

up vote 1 down vote accepted

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");
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.