Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-23-2012, 03:09 AM
Razasharp's Avatar
Razasharp Razasharp is offline
 
Join Date: Feb 2005
Location: UK
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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 12-23-2012, 01:12 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 12-23-2012, 02:39 PM
Razasharp's Avatar
Razasharp Razasharp is offline
 
Join Date: Feb 2005
Location: UK
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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 12-23-2012, 02:49 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you'd want something like this:

Code:
<if condition="TIMENOW - $bbuserinfo[lastpost] < 86400">
// posted in last 24 hours
</if>
Reply With Quote
  #5  
Old 12-23-2012, 02:58 PM
Razasharp's Avatar
Razasharp Razasharp is offline
 
Join Date: Feb 2005
Location: UK
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Kevin

That doesn't work either :/

(It returns true for everyone)
Reply With Quote
  #6  
Old 12-23-2012, 03:01 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 12-23-2012, 03:05 PM
Razasharp's Avatar
Razasharp Razasharp is offline
 
Join Date: Feb 2005
Location: UK
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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


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

Forum Jump


All times are GMT. The time now is 04:51 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
  • Page Generation 0.04075 seconds
  • Memory Usage 2,220KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete