There seems to be some issue with your Facebook Plugin , that's why $user coming as 0. There can be many other reason behind it too.
Lee mas