![]() |
Has posted today conditional?
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. |
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"). |
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 :o |
I think you'd want something like this:
Code:
<if condition="TIMENOW - $bbuserinfo[lastpost] < 86400"> |
Hi Kevin
That doesn't work either :/ (It returns true for everyone) |
Oh - you probably want to use $userinfo, because $bbuserinfo will always be you, no matter whose profile you're viewing.
|
Quote:
Thank you :) |
All times are GMT. The time now is 11:39 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|