PDA

View Full Version : Markup Usernames on Search Results


Scandal
12-08-2015, 07:10 PM
I'm trying to get markup username for the search results page:
https://vborg.vbsupport.ru/external/2015/12/32.png

I wrote the following plugin on hook "search_results_thread_process" (file: \packages\vbforum\search\result\thread.php) :
$getusergroupinfo = $vbulletin->db->query_first("SELECT usergroupid, displaygroupid FROM " . TABLE_PREFIX . "user WHERE userid = " . intval($thread['postuserid']) . "");
$thread['userid'] = $thread['postuserid'];
$thread['username'] = $thread['postusername'];
$thread['usergroupid'] = $getusergroupinfo['usergroupid'];
$thread['displaygroupid'] = $getusergroupinfo['displaygroupid'];
fetch_musername($thread);

... but it means one query (but simple) for each result row-thread, which is not an optimized solution.

Any idea how to get the usergroupid and displaygroupid to be included on $thread by default and don't take it with a new query?
Any idea could be great. :)