Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 23 Dec 2012, 03:09
Razasharp's Avatar
Razasharp Razasharp is offline
 
Join Date: Feb 2005
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.
__________________
Reply With Quote
  #2  
Old 23 Dec 2012, 13:12
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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").
Reply With Quote
  #3  
Old 23 Dec 2012, 14:39
Razasharp's Avatar
Razasharp Razasharp is offline
 
Join Date: Feb 2005
Originally Posted by kh99 View Post
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").
Hi Kevin - thanks for the reply. I'm trying this but it doesn't work :/

<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
__________________
Reply With Quote
  #4  
Old 23 Dec 2012, 14:49
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
I think you'd want something like this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #5  
Old 23 Dec 2012, 14:58
Razasharp's Avatar
Razasharp Razasharp is offline
 
Join Date: Feb 2005
Hi Kevin

That doesn't work either :/

(It returns true for everyone)
__________________
Reply With Quote
  #6  
Old 23 Dec 2012, 15:01
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Oh - you probably want to use $userinfo, because $bbuserinfo will always be you, no matter whose profile you're viewing.
Reply With Quote
  #7  
Old 23 Dec 2012, 15:05
Razasharp's Avatar
Razasharp Razasharp is offline
 
Join Date: Feb 2005
Originally Posted by kh99 View Post
Oh - you probably want to use $userinfo, because $bbuserinfo will always be you, no matter whose profile you're viewing.
You're right! Duh, I should have thought of that!

Thank you
__________________
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Forum Home Enhancements Members who have posted today. Paul M Modification Graveyard 52 20 Aug 2016 21:05
Add-On Releases vBonjour - Who Has Posted Today Add On peterska2 vBulletin 3.6 Add-ons 8 12 Dec 2006 10:41



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 16:30.

Layout Options | Width: Wide Color: