wp_update_user not updating
-
THE OVERVIEW
I am using wp_update_user() in a plugin I have written. I have added a couple of new menu items that should only be visible if the user has the capability “edit_posts” or above.
When a new user is created (via a plugin), they are given the role “subscriber” which means they cant access / view these other menu items.
A script that runs daily uses the following to change users to “editor” role (and therefore the ability to see the menu items):
wp_update_user(array('ID'=>$uid,'role'=>'editor'));
THE PROBLEM
In the DB, the wp_usermeta fields have been updated correctly: (i think?)
wp_capabilities = a:1:{s:6:"editor";s:1:"1";} wp_user_level = 7
BUT
1. When the user logs in, they still cannot see the menu items
2. Viewing the user in the admin area indeed says they are an “editor”
3. If (as admin) I open the user profile and simply click “save”, everything works as expected and I cant for the life of me see any DB changes after the fact?Can someone please help with this? I’m sure it is something trivial
Cheers
Chris
[ Please do not bump, it’s not permitted here. ]
- The topic ‘wp_update_user not updating’ is closed to new replies.