update_usermeta and delete_usermeta do not update or destroy cache
|Reported by:||mark8barnes||Owned by:||ryan|
|Component:||Cache API||Keywords:||needs-testing has-patch|
User meta data is stored in the $current_user variable, which is created as GLOBAL by get_currentuserinfo. However, when update_usermeta and delete_usermeta are called, this variable remains unchanged.
Subsequent calls to get_currentuserinfo just return the existing global variable, and therefore return out of data meta information.
The solution is to check for the existence of the global variable $current_user within the update_usermeta and delete_usermeta functions and either update it or destroy it. Updating it might be more useful, and could be done without needing to recreate the whole variable.
The change could theoretically break plugins if they assumed the existence of the metadata in $current_userinfo, but I can't imagine why anyone would, and it would hardly be good practice if they did.
Change History (21)
comment:15 @cronco — 4 years ago
- Cc cronco added