The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
Is there a conditional I can use for the member profiles to check whether the user has posted today? I'd like to show a graphic if they have.
I noticed the welcome headers hack has this conditional: <if condition="$headerstime - 1209600 > $bbuserinfo[lastpost]"> So perhaps I could use something like that? Maybe something like if Date.today == $bbuserinfo[lastpost].day Anyone have any ideas? Thanks in advance. |
|
#2
|
|||
|
|||
|
If you mean "within the past 24 hours" then (assuming the $bbuserinfo[lastpost] is set) you can check it by subtracting $bbuserinfo[lastpost] from TIMENOW and comparing the result to 86400 (seconds in 24 hours).
If you mean "on today's date" then you'd need a plugin with more code to figure that out. Basically get the day-month-year for today and the post time, and see if they're the same, or maybe get the timestamp for midnight at the start of today and see if $bbuserinfo[lastpost] is greater (and you might have to deal with timezones depending on what you mean by "today"). |
|
#3
|
||||
|
||||
|
Quote:
<if condition="$timenow = TIMENOW"> <if condition="$bbuserinfo[lastpost] > $timenow - 86400"> (Has posted within the last 24 hours) </if> </if> If the lastpost time is greater than now-minus-24hours - it should return true? I am half asleep though so probably doing something wrong
|
|
#4
|
|||
|
|||
|
I think you'd want something like this:
Code:
<if condition="TIMENOW - $bbuserinfo[lastpost] < 86400"> // posted in last 24 hours </if> |
|
#5
|
||||
|
||||
|
Hi Kevin
That doesn't work either :/ (It returns true for everyone) |
|
#6
|
|||
|
|||
|
Oh - you probably want to use $userinfo, because $bbuserinfo will always be you, no matter whose profile you're viewing.
|
|
#7
|
||||
|
||||
|
Quote:
![]() Thank you
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|