The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
One time hook per visit?
Is there a hook that is called once when a user first logs in or when they return to the forum and they remain logged in because they have the "Remember Me" box ticked?
I'm looking at the login hooks, but I'm not sure what happens if the user has ticked the "Remember Me" box. Would any of the login hooks still get called if they aren't typing in their username/password? Basically all I need is a hook that is only called once per visit. Thanks for your help, James |
#2
|
|||
|
|||
I'm guessing that it must be one of those login_* hooks ...
|
#3
|
|||
|
|||
As far as I can tell, the login hooks are only called when the member actually enters their username & password to login, but not if they are a returning visitor who had the "Remember Me" box ticked.
Anyone have any ideas on this? Thanks, James |
#4
|
|||
|
|||
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.
|
#5
|
|||
|
|||
Quote:
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); } Which method would use fewer resources on a busy forum, cookies or sessions? Thanks, James |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|