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.

When a user clicks on an article to "read more" and is then prompted to log in with user name and password, We would like the user to be returned to the article directly instead of being returned to the home page.

We are using the soap-authentication plugin: http://matthewkellett.co.uk/portfolio/soap-auth.php

Using the redirect_to on the loginform's action doesn't work at all.

Adding code

wp-content/plugins/soap-authentication/soap_auth.php

function login_redirect($redirect_to, $request, $user)
{
    $opts = Soap_Auth::getOptions();

    //is there a user to check?
    if(is_array($user->roles))
    {
        //check for admins
        if(in_array("administrator", $user->roles))     
            return home_url("/wp-admin/");
        else
        {
            return $opts['auth_url'];
        }
    }
}

replaced else by

        else
        {
            if ($redirect_to =='')
            {
                return $opts['auth_url'];
            }
            return $redirect_to;
        }
share|improve this question
    
Please add the code you have tried to your question. –  toscho Oct 11 '12 at 16:00
    
If I remember correctly, I had a similar problem today: I added action='wp-login.php?redirect_to=...' to the login form, only to realize that instead you use a hidden field such as <input type="hidden" name="redirect_to" value="<?= $_SERVER['HTTP_REFERER'] ?>"> –  Mike Lewis Oct 11 '12 at 23:25
    
Let me check that out. –  MB34 Oct 12 '12 at 13:17
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.