Thanks cellarius, still does not work on the home page, however the widget is also in my articles template, when I goto the articles page it works fine there.
I did an echo "Executing" to make sure the plugin is executing itself and it does execute on the homepage just does not get put into the widget. here is the code I used.
plugin_lastposts.php
Code:
<?
$date = strtotime('-30 days');
global $vbulletin;
$query = "SELECT count(threadid) as counts FROM `thread` WHERE `dateline` > $date";
$latestpostsread = $vbulletin->db->query_read($query);
$latestpostsfetch = $vbulletin->db->fetch_array($latestpostsread);
$latestposts = $latestpostsfetch['counts'];
?>
plugin code
Code:
require_once('/opt/www/riu/staging/plugin_lastposts.php');
vB_Template::preRegister('vbcms_widget_searchwidget_page',array('latestposts' => $latestposts));
var_dump($latestposts);
vB_Template::preRegister('header',array('test123' => $latestposts));
That second header one is just for testing that it gets registered for the header on the homepage.
the template code:
Code:
<div class="side-bar-box-header">
<div id="speach-bubble">
<span class="posts">x{vb:raw latestposts}x</span><br/>
Threads in the last<br/>30 days
</div>
</div>
<div class="side-bar-box-content">
<p class="title">Posts: {vb:raw prepared.totalposts}</p>
<p class="date">Threads: {vb:raw totalthreads}</p>
<p class="post">Members Online: {vb:raw totalonline}</p>
{vb:raw result_html}
</div>
On maybe a related note the threads / members / Posts variables do not work either.