Issue #2163203 by joelpittet, longwave, saki007ster: Remove calls to deprecated global $user wherever possible (outside bootstrap and authentication).