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
Entire Thread
Subject Posted By Posted
Beta-[6.4] Today and Yesterday bostongio 06/21/2005 1:16 AM
Re: Beta-[6.4] Today and Yesterday AllenAyres 06/21/2005 7:14 AM
Re: Beta-[6.4] Today and Yesterday ScriptZ Man 06/22/2005 1:57 AM
Re: Beta-[6.4] Today and Yesterday bostongio 06/22/2005 2:17 PM
Re: Beta-[6.4] Today and Yesterday ScriptZ Man 06/22/2005 2:40 PM
Re: Beta-[6.4] Today and Yesterday bostongio 06/22/2005 4:11 PM

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
Nettomo
Nettomo
Germany, Bremen
Posts: 417
Joined: November 2001
Forum Statistics
Forums63
Topics37,575
Posts293,930
Members13,823
Most Online6,139
Sep 21st, 2024
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
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)