$user->guest returns NULL - Joomla! Forum - community, help and support


i'm writing component display registered users. table has column online status.
i used following code detect online status

code: select all

$user =& jfactory::getuser($list->id); // $list->id contains user id
if ($user->guest) $online_status = 'off';
else $online_status = 'on';



the problem $user->guest returns null (checked print_r($user)) users displayed online.
all other values in object okay.

can give me answer this?

thank you~!

(a) make sure variable $list->id has valid value.

(b) try statement
if ($user->guest) {$online_status = 'off'} else {$online_status = 'on');

(c) if sql savvy, join table users table session , answer in 1 execution of sql. example, following sql statement provides list of users logged in:

code: select all

select `userid`, `username`, `usertype` `xyz_session` `client_id` = 0 , `guest` = 0;
where xyz_ table prefix joomla! site





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support