I'm no genius with PHP, this will probably be obvious to you at some point soon.
I've written a PHP script to perform a very specific function: find all users who have a session open on the site AND find if they have ticked a particular profile field as yes. I'm not really used to this (ColdFusion and .NET developer, the syntax is confusing me) so please help!
Code:
<?php
function get_onlinehosts($onlinehosts)
{
global $vbulletin;
$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
$onlinehosts = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "session
WHERE userid = $userinfo[userid] AND lastactivity > $datecut AND .userfield.field6 = 'yes'
INNER JOIN " . TABLE_PREFIX . "userfield ON(session.userid = userfield.userid));
{
return $onlinehosts;
}
}
?>