Whenever some users (but not others) log into a WordPress website, their role changes from "Administrator" to "None". Their first name, last name, and nickname also get set to blank. An administrator for whom this is not an issue then has to log in, update the role, re-add the first name, last name, and nickname, and save. But the next time the affected user logs in, it reverts to "None" and the blank fields.
I have tried disabling all plugins and themes, but the problem continues to happen. WP Engine support isn't sure what's going on either. It doesn't happen on a separate staging server that isn't hosted on WP Engine.
This issue is coming may be by a server-side process from WP Engine(for example any custom mu-plugin) or any object caching issue or any security rule that reset user fields on login. I would suggest following things :
1- Check mu-plugins. Go to wp-content/mu-plugins/ folder and look for any file which is updating user role and other fields. If there is any thing like it, rename the mu-plugins folder and test login again.
2- Try disabling WPE_OBJECT_CACHE from wp-config.php
define( 'WPE_OBJECT_CACHE', false );
3- As a temporary fix, you can force-set affected users back to Administrator on login:
add_action('wp_login', function($user_login, $user) {
if ($user->ID === 1) { // Change 1 to the affected user's ID
$user->set_role('administrator');
update_user_meta($user->ID, 'first_name', 'John'); // Replace with correct name
update_user_meta($user->ID, 'last_name', 'Doe');
update_user_meta($user->ID, 'nickname', 'John');
}
}, 10, 2);