if ($vbulletin->userinfo['userid'] && trim($threadinfo[threadid])!='') { if ($rating = $db->query_first(" SELECT * FROM " . TABLE_PREFIX . "threadrate WHERE userid = " . $vbulletin->userinfo['userid'] . " AND threadid = $threadinfo[threadid] ")) { $rated = true; } }