$current_user unfounded assumptions
|Reported by:||filosofo||Owned by:||filosofo|
Currently, a number of places in the code (mainly in MS areas) assume that $current_user is a defined global object, when in fact that's not a safe assumption to make.
For most of the cases, $current_user is brought into scope just to get the current user's ID; in that case get_current_user_id() is much more reliable.
For the others, $current_user should be explicitly defined to make sure that
- If it has not been instantiated, it now will be.
- The pluggable functions get to instantiate it, if applicable.
Patch calls get_current_user_id() when that's what's desired; in the other instances it makes sure that it is defined appropriately.