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;
}