Only define user $user if it's not defined elsewhere

easily done.  I'll update that and merge after.