Fixing undefined var

Fixes to profiles, when the user is not logged in the $user variable is
never set, therefor username issues happen