How does the global variable $user work? 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-&gt;uid return the last created user in the system and not the current logged user. Also the $user-&gt;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?
I would check to see that the block is not getting cached, or that you are not using something like Boost (static caching).

Sounds like the block contents are being cached to me.