vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Detailed Datestamp Display Option AND Timestamp on posts for VB4.2 (https://vborg.vbsupport.ru/showthread.php?t=292162)

Floyd R Turbo 11-29-2012 09:25 PM

Detailed Datestamp Display Option AND Timestamp on posts for VB4.2
 
I found this thread that answered the question of "is it possible"

https://www.vbulletin.com/forum/show...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

kh99 11-30-2012 01:35 AM

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.

kh99 11-30-2012 02:25 AM

OK, if you create a plugin using hook postbit_display_complete and code like this:
Code:

$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 [DATE]1354253981[/DATE] at [TIME]1354253981[/TIME] ---------------

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?

kh99 11-30-2012 01:33 PM

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:

Code:

<vb:else />
        <span class="date">{vb:raw post.postdate}<vb:if condition="!$show['detailedtime']">,&nbsp;<span class="time">{vb:raw post.posttime}</span></vb:if></span>
</vb:if>

and maybe change it to this:

Code:

<vb:else />
        <span class="date">{vb:raw post.postdate}<vb:if condition="!$show['detailedtime']">,&nbsp;<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]">&nbsp;{vb:raw post.postdate_normal}</vb:if>,&nbsp;<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.

kh99 11-30-2012 02:05 PM

Quote:

Originally Posted by Floyd R Turbo (Post 2386823)
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!!!

kh99 11-30-2012 02:49 PM

Quote:

Originally Posted by Floyd R Turbo (Post 2386840)
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? :)

kh99 11-30-2012 04:25 PM

1 Attachment(s)
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?

kh99 10-22-2013 03:53 PM

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


All times are GMT. The time now is 05:49 PM.

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.01085 seconds
  • Memory Usage 1,754KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (17)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete