I've revised this issue a little from the original description:
Steps to reproduce:
- Login as an admin and student in two different browser windows
- As admin edit the student's profile - change the firstname, to add a '1' to the end of it
- As the student go to profile
- The users firstname should be the same in both the user menu and the profile pages
- The user menu ($USER) displays out of date information
This is a fairly niche issue, however it might have more serious consequences if $USER gets too far out of date. Note that we have manual workarounds for this in user/edit.php for the currently logged in user.
As seen in
MDL-50162, when a user edits their own profile/properties we need to manually update the $USER object which is stored in the session. Failing to do so appears as if the value wasn't changed.
This can also potentially be a security concern as an admin that would update a field from another use who's currently logged in will not see the change happening.
I suggest we either:
- Invalid the cache in the session
- Implement auto update in user_update_user