Don't add that select query as this will achieve the same thing and will not add any queries or overhead, just add this to the code and make the html changes to the templates as described above:
find:
PHP Code:
if ($userinfo[receivepm]) {
eval("\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
} else {
$userinfo[pmlink] = " ";
}
below it add:
PHP Code:
if($userinfo['lastactivity'] > $datecut and !$userinfo['invisible'] and $userinfo['lastvisit'] != $userinfo['lastactivity']) {
eval("\$userinfo[online] = \"".gettemplate("postbit_online")."\";");
}
else {
eval("\$userinfo[online] = \"".gettemplate("postbit_offline")."\";");
}
You can apply this to any page to show whether a user is online or offline without touching the session table.