Redirecting after logging in
Hey guys,
I need some help here. I've looked around the forums and got some good background knowledge, but I can't find out how to do this with the latest version of Classipress (3.2.1) specifically.
Basically, if I'm on an ad page, and I click to log-in, I'd like it to redirect to that ad page once I've logged in.
I have a general idea of how I can make that happen (using $_SERVER[HTTP_REFERER]), but I can't find WHERE to make it happen. I tried modifying includes/theme-actions.php, but that doesn't seem to have an effect.
The other thing I tried, which is similar to the registration page, is adding
Code:
<input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect); ?>" />
to the form, and
Code:
if (!isset($redirect)) $redirect = $_SERVER[HTTP_REFERER];
in the php at the top.
This actually works, but it interferes with some of the predefined redirects. For example, when logged out and clicking "Post an Ad," you normally log-in, and it redirects you to step 1 of the create an ad form. With my modification though, it now takes me back to the homepage, which is undesirable. I'm sure there are other instances as well.
So does anyone know how I can change the function for the login redirect, to go from the homepage to the current/previous page?