View Full Version : Detailed Datestamp Display Option AND Timestamp on posts for VB4.2
Floyd R Turbo
11-29-2012, 09:25 PM
I found this thread that answered the question of "is it possible"
https://www.vbulletin.com/forum/showthread.php/216056-Detailed-Datestamp-Display-Option-AND-timestamp-on-posts?highlight=datestamp+display+option
But that thread is outdated.
I wish to be able to have each post display the detailed info (23 minutes ago, 3 days ago, 2 weeks ago, etc) AND the "normal" date/time stamp on each post. I like the former function, but when you get past 7 days everything is lumped into "1 week ago" etc and I hate that. Hybrid/dual functionality is what I want and you can't have both without making a plugin.
I know there is probably a solution out there, can someone point me to it?
Thanks
The link you posted doesn't work, and I'm not sure I understand. Are you looking for a way to do it without using a plugin, or do you need the plugin updated for vb4?
Floyd R Turbo
11-30-2012, 01:44 AM
Sorry try it now.
This thread describes exactly what I want to do - be able to have posts display both the "detailed" and "normal" time stamp at the same time.
OK, if you create a plugin using hook postbit_display_complete and code like this:
$this->post['postdate_normal'] = vbdate($this->registry->options['dateformat'], $this->post['dateline']);
Then you can use {vb:raw post.postdate_normal} and it will always be the "actual" (normal) date. As you can probably see by looking at the existing template, {vb:raw post.postdate} will be the "detailed" date (if you have that set in the options), and {vb:raw post.posttime} will contain the time.
Floyd R Turbo
11-30-2012, 04:24 AM
Thanks. You are talking to a complete newbie to vBulletin though so I will try to see if I can get this figured out...but be prepared for stupid questions!!!
--------------- Added 1354253981 at 1354253981 ---------------
Alright. I tried it and it did not work. I went to Plugins & Products -> Add New Plugin
Product: vBulletin
Hook Location: postbit_display_complete
Execution order: 5 (default, did not change)
Code: as stated
Pluging Active: yes
Save and reload clicked
No change on forum.
i went into Setting -> Options -> Date and Time and toggled back and forth between 'normal' and 'detailed' and it just works as if the plugin is not there, so what was that plugin supposed to do or what am I missing?
The plugin just makes the "normal" date available even if you have "detailed" selected. To see any change you need to edit your postbit or postbit_template and insert {vb:raw post.postdate_normal} where you want the normal date to appear.
So if you're using postbit_legacy (post info on the left side) then you could edit that template and find this section:
<vb:else />
<span class="date">{vb:raw post.postdate}<vb:if condition="!$show['detailedtime']">, <span class="time">{vb:raw post.posttime}</span></vb:if></span>
</vb:if>
and maybe change it to this:
<vb:else />
<span class="date">{vb:raw post.postdate}<vb:if condition="!$show['detailedtime']">, <span class="time">{vb:raw post.posttime}</span><vb:else /><vb:if condition="isset($post[postdate_normal])"><vb:if condition="$post[postdate_normal] !== $post[postdate]"> {vb:raw post.postdate_normal}</vb:if>, <span class="time">{vb:raw post.posttime}</span></vb:if></vb:if></span>
</vb:if>
Floyd R Turbo
11-30-2012, 01:58 PM
Sweet, I think that worked!!
I replaced that code section, turned the plugin on, and set the date/time to detailed and they both show up!
One odd thing I did notice is that the detailed stamp disappears off all posts that 2 weeks or older, and just the normal date/time stamp shows up. Odd.
One odd thing I did notice is that the detailed stamp disappears off all posts that 2 weeks or older, and just the normal date/time stamp shows up. Odd.
The function that does the yesterday, one week ago, etc, seems to only go to 5 weeks, then it just displays the normal date. If you're seeing a cutoff of 2 weeks, I can't explain that. Are you sure it's 2 weeks?
Floyd R Turbo
11-30-2012, 02:35 PM
Oh I know why. I installed the forum and started some posts under moderator forums to test things out, then made the site live to the public just over a week ago. So there are no posts that are equal to or greater than 2 weeks old, except for a handful of threads that are greater than 5 weeks old. So the 5+ wk old thread just show the time/date. Of note, the "detailed" datestamp function for posts over 5 weeks old defaults to only the date, and leaves off the time of the post. I don't like that function either, this fix solves that as well
Thanks so very much!!!
Of note, the "detailed" datestamp function for posts over 5 weeks old defaults to only the date, and leaves off the time of the post. I don't like that function either, this fix solves that as well
Yeah, I changed that on purpose because otherwise the time just "disappeared" when the date was 5 weeks old, and it looked strange. The default code didn't display the time at all if you had "detailed" selected, which seemed odd.
Mr_Running
11-30-2012, 04:06 PM
Sometimes...I feel like I am in the dark...what does this look like? Care to share a screenshot? :)
See attached. Normally the date/time wouldn't be there when it says "2 Hours Ago".
Art Andrews
10-22-2013, 03:43 PM
I have a question on this fix. I used detailed because members love the immediacy of "2 minutes ago." The issue I see with this approach is that once you hit the 5 week mark, don't you end up with double dates since detailed reverts to date at that point anyway?
This was a while back so I'm not sure if I remember, but I think if you make the edit I posted in post #6 above, it will not show both times if they are the same.
Floyd R Turbo
10-22-2013, 04:03 PM
You do not end up with double dates after you are past the 5th week, the code works perfectly!
Art Andrews
10-22-2013, 04:36 PM
Worked beautifully! Thanks, Floyd and kh99!
soccerman2015
02-17-2016, 07:20 AM
thank you kh99
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.