View Full Version : Showing thread/post age rather than date?
ArgylePhoto
11-11-2008, 07:12 AM
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 :)
Lynne
11-11-2008, 02:45 PM
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:
if ($forumid == 'xx')
{
$vbulletin->options['yestoday'] = '2';
}
Not Tested!!!!
ArgylePhoto
11-11-2008, 06:21 PM
I wouldn't even know where to begin doing that sorry :o
I can play about with template mods til the cows come home but with php stuff I'm totally lost
Lynne
11-11-2008, 06:24 PM
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.
ArgylePhoto
11-11-2008, 06:32 PM
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?
Lynne
11-11-2008, 06:36 PM
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). :)
ArgylePhoto
11-11-2008, 07:04 PM
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?
Lynne
11-11-2008, 07:47 PM
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).
ArgylePhoto
11-11-2008, 08:02 PM
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.
Lynne
11-11-2008, 08:46 PM
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.
ArgylePhoto
11-11-2008, 08:53 PM
Showthread and forumdisplay.
Would two plugins work? Like one at "showthread_getinfo" and the equivalent for forumdisplay (assuming there is one).
Lynne
11-11-2008, 09:02 PM
Yeah, you can always copy the plugin to use in two different places. See if it works in the showthread one. For forumdisplay, you can try "forumdisplay_start"
ArgylePhoto
11-11-2008, 09:03 PM
I tried that and it seems to have worked! Thank you very much for your help :)
Lynne
11-11-2008, 09:04 PM
Glad you got it working. And you made your first own plugins, too. :)
ArgylePhoto
11-11-2008, 09:12 PM
Well, copied and pasted lol, but I do feel like I've achieved something!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.