PDA

View Full Version : Show userfield in what's going on (almost there)


Speedy131
12-12-2012, 01:44 PM
Hi ;)

So i'm trying to display an image infront of the usernames in the "currently active users" list of what's going on.

The name of the image is stored in the userfields table, as field6

So far I've added the lookup of the userfield in the "logged in users" query in forum.php, so now it looks like this
$forumusers = $db->query_read_slave("
SELECT
user.username, userfield.field6, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible, user.usergroupid, user.lastvisit,
session.userid, session.inforum, session.lastactivity, session.badlocation,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
$hook_query_fields
FROM " . TABLE_PREFIX . "session AS session
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid)
LEFT JOIN " . TABKE_PREFIX . "userfield AS userfield ON(userfield.userid = session.userid)
$hook_query_joins
WHERE session.lastactivity > $datecut
$hook_query_where
" . iif($vbulletin->options['displayloggedin'] == 1 OR $vbulletin->options['displayloggedin'] == 3, "ORDER BY username ASC") . "
");

when I run the query, field6 shows up, so far so good

under the forumhome_loggedinuser hook in forum.php I've put
$loggedin['image'] = $loggedin['field6'];

in the forumhome template I've put
<img src="{vb:stylevar imgdir_misc}/{vb:raw loggedin.image}.gif" /> {vb:raw loggedin.musername}

But the image filename doesn't show up :confused:
To test I've changed $loggedin['image'] = $loggedin['field6'];
into $loggedin['image'] = $loggedin['usergroupid'];
and that does give a filename (an incorrect one, but anyway)

any idea where I went wrong?