The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
CMS Widget Caching, still running query on every refresh
I've created a PHP Direct Execution CMS Widget with this code to count the number of donating members:
Code:
global $vbulletin; $cmember = $vbulletin->db->query_read_slave("SELECT count(*) as num FROM " . TABLE_PREFIX . "user AS user WHERE user.usergroupid IN (9) OR FIND_IN_SET(9, membergroupids)"); $cmembers= $vbulletin->db->fetch_array($cmember); $content = array('cmembers' => $cmembers[num]); vB_Template::preRegister('vbcms_widget_mywidget',$content); Code:
SELECT count(*) as num FROM vbuser AS user WHERE user.usergroupid IN (9) OR FIND_IN_SET(9, membergroupids) Thanks! --------------- Added [DATE]1408560000[/DATE] at [TIME]1408560000[/TIME] --------------- This was my own stupid fault. I just pasted in the plugin code, didn't actually set the variable to $output, which the widget instructions told me to do Basically changed to this: Code:
global $vbulletin; $cmember = $vbulletin->db->query_read_slave("SELECT count(*) as num FROM " . TABLE_PREFIX . "user AS user WHERE user.usergroupid IN (9) OR FIND_IN_SET(9, membergroupids)"); $cmembers= $vbulletin->db->fetch_array($cmember); $output = array('cmembers' => $cmembers[num]); vB_Template::preRegister('vbcms_widget_mywidget',$output); |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|