Message for user when no password or username is filled in
-
Hi guys,
I made a redirect php code the the main forum page but i want to display a custom message for each action that is made. So i the user doesn’t enter a password or a username i want to display a message like, you did enter the wrong password or username, please try again.
How do i add this in the php code?
This is the php code i got from the internet for redirecting to the forum page if…. .
add_filter( ‘login_redirect’, ‘login_redirect’, 10, 3 );
add_action(‘login_redirect’, ‘redirect_login’, 10, 3);
function redirect_login($redirect_to, $url, $user) {
if($user->errors[’empty_password’]){
wp_redirect(get_bloginfo(‘url’).’/forum/’);
}
else if($user->errors[’empty_username’]){
wp_redirect(get_bloginfo(‘url’).’/forum/’);
}
else if($user->errors[‘invalid_username’]){
wp_redirect(get_bloginfo(‘url’).’/forum/’);
}
else if($user->errors[‘incorrect_password’]){
wp_redirect(get_bloginfo(‘url’).’/forum/’);
}
else{
wp_redirect(get_bloginfo(‘url’).’/forum/’);
$a = “Hello “;
}
exit;
}Thanks in advance,
Jottem15
- You must be logged in to reply to this topic.