Here is my scenario:
I create a new user and dynamically create for him some content on which he is the owner.
Each user can log in, see his content and edit his profile. I use a block in which I have a menu links to each content and to his profile.
The theme output of the block function uses
global $user; to get the current logged user.
However, the strange thing is that
$user->uid return the last created user in the system and not the current logged user. Also the
$user->language is of the last created user in the system. Why?
The user logs out with
user/logout; this is the command to log out, right? Do I need to do more after user logout such as GLOBAL variable resets?