The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
show text only once per day by vbulletin session or cookie
Hello ,
can i use vbulletin session or cookie to show text only once per day for users and visitors ? THANKS :up: |
#2
|
|||
|
|||
I suppose you could set a cookie to expire in 24 hours, then if someone doesn't have that cookie with a request, display the text and create the cookie.
Or you might be able to check whenever a session is created, and see if their last activity is more than one day ago, but I don't know the details of how to do that offhand. Well, I guess that's not quite right, since that way if they visited often they may never see the text. I guess you'd have to check for lastactivity being in the previous day or earlier. |
#3
|
||||
|
||||
thanks brother
Quote:
Quote:
|
#4
|
|||
|
|||
There is a $vbulletin->session->created variable that's true when a session gets created, but I think it's kind of tricky to use, since sometimes the user gets redirected after the session is created and it won't be true anymore when you go to check it to display the text. I tried to write a plugin that checked that variable, and it never seemed to be true when logging in.
There's a vbulletin function vbsetcookie(), but it doesn't look like it allows setting of the expiration time, so I guess you'd have to use the php functions directly. I really don't know a lot about cookies so it's probably better if you research that if you want to go that route (unless of course someone else wants to provide the code). You could also add a column to the user table and store the last time they saw the text, then you'd just have to check to see if it's today or not, and if not show the text and update the field. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|