function myplugin_authenticate_on_hold($user)
{
// username and password are correct
if ($user instanceof WP_User) {
$on_hold = get_user_meta($user->ID, 'is_on_hold', true);
if ($on_hold) {
return new WP_Error('on_hold_error', 'You are on hold');
}
}
return $user;
}
add_filter('authenticate', 'myplugin_authenticate_on_hold', 21);
The priority needs to be 21, as wp_authenticate_username_password
and wp_authenticate_email_password
are priority 20. They return an object of the type WP_User
if they could authenticate the user. So if the user is authenticated, check if he is on hold. If he is, show the user an error.
Edit: why aren’t you using the default login form?
Related Posts:
- How can I redirect user after entering wrong password?
- Custom login form
- Prevent wp_login_form() from redirecting to wp-admin when there are errors
- How do I change the language of only the login page?
- Disable WordPress 3.6 idle logout / login modal window / session expiration
- Avoid to load default WP styles in login screen
- How to fake a WordPress login?
- Can not login with correct username and password
- How can I add a custom script to footer of login page?
- How to keep always logged in development environment
- I want to disable E-Mail verifcation / activation when a user signs up for my WordPress site
- custom login page redirect to logged in user profile page
- Action wp_login_failed not working if only one field is filled out
- How to customise wp-login.php only for users who are setting a password for the first time?
- WordPress Login Footer URL
- Remove built in wordpress login and use only google auth
- Change Login Page for a Multisite Subsite
- Positioning the “Lost your password?” and “← Back to Site”
- send users logging in from wp-login.php directly to home page of site, rather than dashboard
- How to get login data (session) outside WordPress?
- Add class to input form in login form
- Allow access to a page for admins only
- Customizing login error messages
- Customizing the WordPress login form
- Restricting frontend acess based on user role otherwise redirect to login form
- How do I force “users must be registered and logged in” on subsites?
- deny IPs from wp-login using .htaccess
- Passing username to login screen
- Login error redirecting to wp-login page
- How can I prevent my custom form from redirecting to wp-login?
- reset password link redirect to login page
- How do I replace “Username” in the WordPress login form?
- Custom Login iframe doesn’t work
- Password reset – Disabled for LDAP accounts
- How to Get Logged-in to “Remote WP Site” from my local script (in Same Browser)?
- Replace dash with space in username on login
- Autologin only working the second time
- replace wp-login.php login forms via a hook & use custom forms with wp-login form validation
- Auto login between word press subdomain and a .net website
- Disabling standard registration login with username/email and password?
- How to change wordpress Log In text
- WordPress error on log out ‘Not Permitted’ and can’t log out
- Redirect wp-login
- Is wp_login_form secure on a non secure page?
- Is the login encrypted before it is sent? If so how to do I encrypt it the same way?
- Form Action submit over https
- Is there anyway to get the inputted password string from the login form?
- Login and Forgot password in Lightbox
- Forcing frontend login with UI switch
- Prevent display password on wp-login.php
- Change default login auth
- wordpress login without password just email address (NO 2 factor authentication with email)
- WordPress SSL not working [closed]
- Where is the php file, that does the checks for login information?
- Cannot Get User id after login success in file wp_login.php
- Alert Message through email or phone(Message)
- Moving from one host to another – cannot access the dashboard
- Temporally disable password to login with empty password?
- How are all users now set to inactive?
- woocommerce store login not working at first time
- How do I change the language of the login page to Arabic?
- How do you implement a login feature on a WordPress site?
- How to add custom authentication to wordpress login and register
- Problem in auto login after registration
- Login form does not store/remember/suggest users password
- Custom user roles are unable to login
- Using is_user_logged_in() to lock down whole site
- Check for $ _POST fields in a POST method form
- Styling WordPress login page – Can I change the markup on the login page?
- Special link for no automatic login (no username and no password)
- Modify wp-login.php Labels Conditionally Based On Referring URL
- Can’t login with any account – No error message shown
- WordPress Login & Register works in localhost but don’t work on server
- How to login to wordpress via Cpanel
- Hide login page and use wp_login_form on ordinary pages
- Make WordPress User Name the Email Address When Register
- Custom Field For Login
- How can I have customers log in using ONLY customer number? No password
- Login user after registration programmatically
- How to place wp-login.php in page or page template?
- Webpage not found upon entering wrong username and password on custom login form?
- Can’t login through wp-login.php on fresh installation
- Hide wp-login.php but not the widget
- Showing A Menu When Only Users Are Logged In [duplicate]
- Logging in takes a few refreshes to show you are logged in, is this a cache issue? [closed]
- I can’t login to wordpress dashboard without SSH
- Login form- no feedback
- Remove login link from Reset Password-screen
- Why am I not able to login to the admin
- How to pass users back and forth using session data?
- Is there a better way than checking user is logged in to show or hide adminbar?
- A truely custom login page?
- Disable Admin CP authentication (or auto login)
- Display first name instead of username
- How to Prevent Brute Force Attack on WordPress
- Bypass login page
- WordPress login is not showing , there is warning?
- WordPress Redirect After logging
- How to Create a login for for subscribers only
- Users cannot log in using popup