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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-11-2008, 07:12 AM
ArgylePhoto ArgylePhoto is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Showing thread/post age rather than date?

Hi,

In one of my forums I'd like to display the age of a thread rather than the date it was created on, is there any easy way to do that?

Specifically the forum is filled with one-post threads (for sale adverts) and on the threadbit template I have the date of the last post (which is obviously the original post) showing just as 'dd/mm/yyyy' with no other info, but I'd like to change that to an advert age like 'xx days'. I'd also like to have that info in the showthread template too instead of a date.

Thanks in advance
Reply With Quote
  #2  
Old 11-11-2008, 02:45 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you need to create a plugin that changes the vboptions 'yestoday' to Detailed (value=2) for that forum. So, maybe try the fetch_foruminfo hook location? Something like:
PHP Code:
if ($forumid == 'xx')
{
    
$vbulletin->options['yestoday'] = '2';

Not Tested!!!!
Reply With Quote
  #3  
Old 11-11-2008, 06:21 PM
ArgylePhoto ArgylePhoto is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wouldn't even know where to begin doing that sorry

I can play about with template mods til the cows come home but with php stuff I'm totally lost
Reply With Quote
  #4  
Old 11-11-2008, 06:24 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, the only way to do what you want it through a plugin/php code. If you don't want to try it, I can't really suggest anything else.
Reply With Quote
  #5  
Old 11-11-2008, 06:32 PM
ArgylePhoto ArgylePhoto is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No no I will try it, I need to learn, but I don't expect to succeed lol.

What I meant was I don't really know what to do with the code you gave me?
Reply With Quote
  #6  
Old 11-11-2008, 06:36 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You create a new plugin - Plugins & Products > Add New Plugin

Pick a hook location - maybe try fetch_foruminfo like I suggested
Title - whatever
Execution Order - leave alone
Plugin PHP Code - put what I wrote above but put your forumid in where it says xx
Plugin is Active - Yes

And see what happens in your forum (if it's correct in there, also make sure it is still fine in the other forums).
Reply With Quote
  #7  
Old 11-11-2008, 07:04 PM
ArgylePhoto ArgylePhoto is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That worked a treat, thank you very much!

Is there a way to change it to be more accurate? So that when a thread is a week or more old it I still get the age in days?
Reply With Quote
  #8  
Old 11-11-2008, 07:47 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I do not think so. I don't use that setting, but on other sites where I have seen it, it does hours up to 24, then days up to 7, then weeks up to ??, and then months. As far as I know, you can't change how it does that (except by probably modifying the php code in the page - not a plugin like we just did).
Reply With Quote
  #9  
Old 11-11-2008, 08:02 PM
ArgylePhoto ArgylePhoto is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I'm only gonna use it on this one page so if anyone kew which bit to edit I'd give it a go?

I've noticed a wee problem with the plugin tho in that the 'you last visited...' message in the navbar shows a 'detailed' time on that forum now, it's normal on all the others.
Reply With Quote
  #10  
Old 11-11-2008, 08:46 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm, you should probably change the hook location then. I'm not sure where to suggest since I'm not sure what pages it is you are wanting to have this detailed time. Is it only on the showthread page? If so, you can probably change the location to "showthread_getinfo". See if that works better for 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 08:49 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06278 seconds
  • Memory Usage 2,251KB
  • Queries Executed 11 (?)
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_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete