• In a plugin which I’m working on I’m calling wp_update_user in one function then in another function I’m calling get_currentuserinfo. And everything works fine. Except when I have a third function call those two functions. In a nutshell I’ve got this.

    `function main() {
    if ($_POST[‘submit1’]) {
    $this->update_settings();
    }
    $this->show_settings();
    }`

    Inside update_settings I call wp_update_user and change the users role as needed based on logic within the function. The call to wp_update_user works fine. If after the page has loaded I use another browser to go look at the list of users, the new role is set correctly. But the output of the function show_settings, which is calling get_currentuserinfo and dropping the value from $current_user->roles into a variable has the prior role value. If I refresh the page making no other changes I see the correct role.

    Any ideas as to why this is happening, and more importantly how can I make it so that my call to get the users roles returns correctly when the page is finished drawing?

  • The topic ‘wp_update_user followed by get_currentuserinfo’ is closed to new replies.