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