Trustmaster |
|
---|---|
What you need is just the current user object which is $usr / {PHP.usr} depending on whether you are in PHP or TPL. It has some commonly used properties which are set in system/common.php lines 322-336: $usr['id'] = (int) $row['user_id']; $usr['name'] = $row['user_name']; $usr['maingrp'] = $row['user_maingrp']; $usr['lastvisit'] = $row['user_lastvisit']; $usr['lastlog'] = $row['user_lastlog']; $usr['timezone'] = cot_timezone_offset($row['user_timezone'], true); $usr['timezonename'] = $row['user_timezone']; $usr['theme'] = ($cfg['forcedefaulttheme']) ? $cfg['defaulttheme'] : $row['user_theme']; $usr['scheme'] = $row['user_scheme']; $usr['lang'] = ($cfg['forcedefaultlang']) ? $cfg['defaultlang'] : $row['user_lang']; $usr['newpm'] = $row['user_newpm']; $usr['auth'] = unserialize($row['user_auth']); $usr['adminaccess'] = cot_auth('admin', 'any', 'R'); $usr['level'] = $cot_groups[$usr['maingrp']]['level']; $usr['profile'] = $row; What you need to check to know whether the user is logged in or not is this: if ($usr['id'] > 0) { // User is logged in } else { // This is a guest } There are actually more fields available for users than listed above. All fields present in `cot_users` table (including extrafields) are available via $usr['profile'] array. For example, here is how you can get the avatar image path: $usr['profile']['user_avatar']
May the Source be with you!
|