I modifed a news module and now it showing latest post of thread and poster user name, status and more info from "user" table.
But I need fetch ranks from "ranks" table of this user with specified ID.
How make this query and how fetch result?
My current query if needed:
Code:
$getnews = $db->query_read("
SELECT $ratingsql user.*, userfield.field11 AS gender, usergroup.opentag, usergroup.closetag, thread.threadid, post.title, thread.replycount, thread.lastposter AS postusername, postuserid, thread.lastpost AS postdateline, sticky, thread.attach, thread.lastpostid, thread.lastposter, thread.lastpost, IF(views<=thread.replycount, thread.replycount+1, views) AS views, thread.forumid, post.postid, pagetext
$vba_news_fields
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.lastpostid)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = post.userid)
LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (userfield.userid = post.userid)
LEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.displaygroupid)
$vba_news_join
WHERE thread.threadid IN(" . implode(',', $newstids) . ")
" . iif(!$threadsqueried AND $mod_options['portal_news_cutoffdate'], 'AND thread.lastpost > ' . (TIMENOW - ($mod_options['portal_news_cutoffdate'] * 86400))) . "
" . iif($ignusers, 'AND thread.postuserid NOT IN(' . $ignusers . ')') . "
" . iif($mod_options['portal_applypermissions'], $forumperms_query) . "
ORDER BY " . iif($mod_options['portal_news_sticky'], 'sticky DESC, ') . $mod_options['portal_news_orderby'] . " $mod_options[portal_news_direction]
" . iif($limitapplied, 'LIMIT ' . ($mod_options['portal_news_maxposts'] + $mod_options['portal_news_enablearchive']), $newslimit) . "
");