Hello Jason,
Thank you very much.
But i still don’t understand. this is the code i’m using. Please correct me if i’m wrong.
This is my s2-hacks.php code
add_filter("ws_plugin__s2member_login_redirect", "redirect_password_login_redirect", 10, 2);
function redirect_password_login_redirect($redirect, $vars = array('user' => null)) {
if( isset($user->ID) ) {
$changed_password = get_metadata("user", $user->ID, "changed_password",true);
if( $changed_password != true ) {
return get_bloginfo('url') . "/change-password/";
} else {
return $redirect;
}
}
}
In functions.php i have function like this
// Log In User
function log_in_user($username, $password) {
// Get the user based on the username from the POST
$user = parse_user($username);
// Remove html tags from the title and content fields
$username_stripped = strip_tags($username);
$password_stripped = strip_tags($password);
// Validate the Form Data
if(isEmptyString($username_stripped)) return new WP_Error('forgot_username', 'You forgot to enter your Username');
if(isEmptyString($password_stripped)) return new WP_Error('incorrect_password', "You forgot to enter your Password.");
if(!wp_check_password( $password_stripped, $user->user_pass ) ) return new WP_Error('incorrect_password', "You seem to have entered a wrong password.");
wp_set_auth_cookie($user->ID, $remember);
wp_login($username_stripped, $password_stripped);
wp_redirect(apply_filters('ws_plugin__s2member_login_redirect', get_bloginfo('url') . '/my-account/', $user));
exit;
}
Its supposed to redirect me to change-password page. Instead it still redirect me to my-account page.
Am i applying filter incorrectly? Thanks