I'm creating a user profile and I thought it would be nice to see if the user is online or not. I added the next code I found here (in drupal.org):

<? Php
print ""
$ Time_period = variable_get ('user_block_seconds_online', 2700);
$ Uid = arg (1); / / get the current userid That Is Being viewed.
$ Users = db_query ("SELECT uid, name, access FROM (users) WHERE access> =% d AND uid = $ uid", time () - $ time_period)
$ Total_users = db_result ($ users);

if ($ total_users == 1) (
$ Output = t (' Connected ');
)
else (
Output = $ t (' Offline ');
)

print $ output;
print "";
?>

The problem is that only works with my user profile, if you visit the profile of a "normal"l user always appears as "off-line." I'm using drupal 6 and "content profile" to create the user profiles.

I think it may be because the content-profile module makes programming fails, but can not find the solution.

Does anyone can help me to try to get it to work? Anybody know any other code that serve to this purpose?

In any case,
Greetings to the whole community.

Barry Collins