The user_status
field isn’t used by core, so you could use it for your own purposes. Although there may be side effects if WP ever decides to reuse it in the future.
The authenticate
filter fires before the user is authenticated. You can hook into that filter and return a WP_Error
object to prevent the user from logging in.
function wpse_293904_authenticate( $user, $username, $password ) {
$user_status = get_custom_user_status_from_username( $username );
if( ! $user_status ) {
$error = new WP_Error();
$error->add( 403, 'Oops. Some error message.' );
return $error;
}
return $user;
}
add_filter( 'authenticate', 'wpse_293904_authenticate', 20, 3 );
Related Posts:
- Check for user meta data at Login
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- user and usermeta table not found
- WordPress – Security Question at Login from User’s Meta Data
- user_login vs. user_nicename
- get_user_meta() doesn’t include user email?
- How to display the status of users (online – offline) in archive.php
- How to display custom user meta from registration in backend?
- Allowing an email as the username?
- Grouping users under parent user
- Extending WP_User class and using this sub-class during the whole lifecycle
- Why does is_user_logged_in() return false after redirect from another site?
- How we can get the user id by its display_name
- WP_User_Query with combined meta query – not working?
- LEFT JOIN, INNER OUTER JOIN, LEFT OUTER JOIN is driving me crazy. Please help?
- Show Biographical Info while creating new user
- How to add follow functionality to multi-author wordpress site?
- Search multiple meta keys at once
- Get user info outside WordPress
- ACF Upload Image in front-end with custom form
- How can I secure a WordPress blog using OpenID from a single provider?
- Is it possible to get a user with just the password field?
- Hide a user from WordPress
- Redirect after login based on user role (custom login page)
- My custom page template with is_user_logged_in() does not detect that I’m logged in
- How to add country drop down menu to the user profile?
- Use phpbb user database for WordPress
- Delete user from frontend
- Add custom fields to the user profile
- Share user table from WP with Drupal
- Memory usage for scalable usermeta queries
- How can I allow password reset based on logins containing the @ character?
- A way to count logged in users and display count?
- Does wp_delete_user() remove all user content?
- WP User Query fails when searching meta queries and search columns
- How can i create an array user meta?
- How do i make my wordpress website private?
- Updating user meta
- WordPress User Meta & ChromePHP or other way to debug/view php variables
- Change the user_login at registration
- Are User Levels Still Currently Used?
- When I try to login in wordpress it is showing “USER Doesn’t Exists”
- get_user_meta an ID for multiple functions
- wordpress disable login for unverified user
- Reset Password policy
- Rewrite Rules and Login Issue
- Is possible to allow user to login with different role?
- Creating user without username and password
- Is this code true or not
- users and usermeta table
- User description only displayed for logged user
- The Simple and Correct Way to Add User Meta
- How to check User Role and redirect to specific page according to Role when login in WordPress?
- “the_author_meta(‘url’)” not working inside “href”
- Assign random (and unique) user meta upon registration
- How do you manage your pages or functions that require logged-in users?
- Display the line breaks in user bio without using html
- how to set default update_user_meta values wordpress
- Get user by meta key – WP multi site
- Cannot Update user meta in custom field
- Can I Create a Second Admin Level User Role?
- Delete a user from frontend
- Recovering the table wp_usermeta from users
- Check if user is logged in via JS? [duplicate]
- New User Save Filter
- Assigning multiple or additional capabilities to specific users or how to create additional roles like bbpress roles?
- wp_generate_password sets password but can’t login using created password
- delete_user_meta from a foreach results page
- add class to element if user is not logged in [closed]
- Reading additional fields in PMPro
- Is there a way to call via javascript if a user is logged-in on a static html file?
- Can I add a unique code for each user based on the location?
- Getting user data via ajax
- Get UserInfo from WordPress
- How to change default username field after login
- The same session information for peer users on two different WordPress servers
- Safely changing UserID’s, re-using deleted UserID’s and automatically using deleted userID’s instead of an increment
- $user_login is not working if author has only 1 post
- REST_query_vars for users
- In admin manage users page, how can I stop users with certain privileges from editing users with other privileges?
- UserMeta Changes Meta Value for Post ID
- Add method for tracking who referred new users
- Username has been exposed
- User management missing after migration to new host
- Validate user meta and redirect
- Changing user_login ends current session
- Let admin users edit member profiles from front end
- Does WordPress Need BuddyPress to Handle Large Amounts of Users?
- Current User Seeing Another Logged In User Info
- Using and saving custom dropdown boxes on user profiles
- Securely log in a user without a password using a link?
- Store subscription details for users in WordPress
- hide woo commerce dashboard status and reports from woo commerce from specific users but display to other users
- How to add custom detail page for a Subscriber at Admin Panel
- Add custom input field in new user page
- determine active user browser at the same time
- How to track all users logged into a site?
- MySQL query to list users who never signed in
- How to authenticate/verify login credentials & check for user meta without logging in?
- Export user data from Squirrly’s Starbox plugin?