Quote:
Originally Posted by Danny.VBT
You could use a global hook. Even though it is called on every page, you can use a conditional to only execute your code once per visit. You'll probably find a solution using cookies. 
|
Thanks
Danny.VBT.
I worked out a cookie solution with the
global_start hook, comparing TIMENOW to the time I set in the cookie. If more than an hour has passed since the cookie was set, I run my code.
Code:
$recountcookie = COOKIE_PREFIX . 'recount';
$recountcookietime = TIMENOW;
$vbulletin->input->clean_gpc('c', $recountcookie, 'TYPE_INT');
if ($vbulletin->GPC["$recountcookie"] <= ($recountcookietime - 3600))
{
//Code to do my processing here
//and then set a new cookie
vbsetcookie('recount', $recountcookietime);
}
I also started looking at the article
[How-To] Extend and use the Session Table Effectively
Which method would use fewer resources on a busy forum, cookies or sessions?
Thanks,
James