Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2004
Posts: 8
Lurker
Lurker
Offline
Joined: Sep 2004
Posts: 8
Mod Name / Version: Today and Yesterday

Description: You know how some forums list posts with the date showing "Today" or "Yesterday" as the post date (instead of or in addition to the actual dates)?

This mod makes a simple change to ubbt.inc.php to add this functionality.



Working Under: UBB.Threads 6.4

Mod Status: Beta

Any pre-requisites:

Author(s): bostongio

Date: 06/20/05

Credits: Other forum software

Files Altered: ubbt.inc.php

New Files:

Database Altered: No

Info/Instructions:
In ubbt.inc.php

Find (under Convert the time):

Code
<br />      if ($timeformat == "short1") {<br />        $time = @date("m/d/y h:i a", $time);<br />      }<br />      elseif ($timeformat == "short2") {<br />        $time = @date("d/m/y h:i a", $time);<br />      }<br />      elseif ($timeformat == "short3") {<br />        $time = @date("y/m/d h:i a", $time);<br />      }<br />      elseif ($timeformat == "short4") {<br />        $time = @date("d/m/Y H:i", $time);<br />      }<br />                elseif ($timeformat == "short5") {<br />                        $time = @date("H:i d/m/Y", $time);<br />                }<br />      elseif ($timeformat == "long") {<br />        $time = @date("D M d Y h:i a", $time);<br />      }<br />


Replace with:

Code
<br />// Still show the date in addition to the words "Today" and "Yesterday"? 1 = Yes, 0 = No<br /><br />$j_show_moddate = 1;<br /><br /><br />  $j_today = date("m/d/y");<br />  $j_yesterday = date("m/d/y", strtotime("-1 day"));<br />  $j_tdate = @date("m/d/y", $time);<br />  $j_time  = @date("h:i a", $time);<br /><br />  if ($j_show_moddate) {<br />        $j_showdate = "($j_today)";<br />        $j_showyester = "($j_yesterday)";<br />  }<br /><br />  if ($j_tdate == $j_today) {<br />        $time = "Today $j_showdate at ".$j_time;<br />  }<br />  elseif ($j_tdate == $j_yesterday) {<br />        $time = "Yesterday $j_showyester at ".$j_time;<br />  }<br />  else {<br /><br />      if ($timeformat == "short1") {<br />        $time = @date("m/d/y h:i a", $time);<br />      }<br />      elseif ($timeformat == "short2") {<br />        $time = @date("d/m/y h:i a", $time);<br />      }<br />      elseif ($timeformat == "short3") {<br />        $time = @date("y/m/d h:i a", $time);<br />      }<br />      elseif ($timeformat == "short4") {<br />        $time = @date("d/m/Y H:i", $time);<br />      }<br />                elseif ($timeformat == "short5") {<br />                        $time = @date("H:i d/m/Y", $time);<br />                }<br />      elseif ($timeformat == "long") {<br />        $time = @date("D M d Y h:i a", $time);<br />      }<br />  }<br /><br />




Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3


- Allen wavey
- What Drives You?
Joined: Jan 2005
Posts: 39
User
User
Offline
Joined: Jan 2005
Posts: 39
Any suggestion for v6.5?

Joined: Sep 2004
Posts: 8
Lurker
Lurker
Offline
Joined: Sep 2004
Posts: 8
I don't have copies of the other versions, so I can't check out and see if the code is similar or the same. Does such a subroutine exist in ubbt.inc.php in 6.5? If so, the mod should work just fine.

Joined: Jan 2005
Posts: 39
User
User
Offline
Joined: Jan 2005
Posts: 39
[]bostongio said:
I don't have copies of the other versions, so I can't check out and see if the code is similar or the same. Does such a subroutine exist in ubbt.inc.php in 6.5? If so, the mod should work just fine. [/]

Unfortunately it doesn't

Sponsored Links
Joined: Sep 2004
Posts: 8
Lurker
Lurker
Offline
Joined: Sep 2004
Posts: 8
Hmmm, how does 6.5 handle time conversion? I suspect the function is still in the code, but perhaps they just moved it or renamed it... Because there has to be a function to handle formatting the time and date to the board preferences....

You could do a grep on timeformat or convert_time and see if it appears in some other file elsewhere. Sorry, if I get a chance I'll download a copy of 6.5 and look for it myself...


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)