Version: 1.00, by bigmattyh
Developer Last Online: Mar 2014
Version: 2.2.x
Rating:
Released: 01-26-2002
Last Update: Never
Installs: 326
No support by the author.
YESTERDAY/TODAY DATESTAMP HACK - Updated 5/25/02
Tested and working on vB 2.2.1 -> 2.2.6
Description: This hack replaces the standard "05-25-02, 02:45 PM" date with "Today" or "Yesterday" anywhere you have a date posted, if the date matches today's or yesterday's date.
The following are add-ons that may be helpful depending on your specific needs.
Extra features:
Template-based version : Allows you to specify different values for "Today" and "Yesterday" -- useful if you have multiple language style sets on your board. (i.e., you can set the value for today to "Today" in your English style set, and "Aujourd'hui" for your Francais style set.)
Helpful template hacks: Due to the way the standard vB template set handles date columns in forumhome.php and forumdisplay.php, some template changes may be of use:
UPGRADING FROM VERSION 1:
1. Open functions.php, in your /forum/admin/ directory.
2. Scroll down to around line 1500, where you should find the altered version of the function vbdate (which you modified in version 1 of this hack). This function ends with the following lines:
} else {
$date = date($format,$timestamp+($bbuserinfo['timezoneoffset']-$timeoffset)*3600);
}
return $date;
}
3. After this block of code, add the following block:
function vbdatenoty($format,$timestamp) {
global $bbuserinfo,$timeoffset;
return date($format,$timestamp+($bbuserinfo['timezoneoffset']-$timeoffset)*3600);
}
when i do this i get this error
Code:
Fatal error: Cannot redeclare vbdatenoty() (previously declared in /home/bugz/public_html/vb/admin/functions.php:1633) in /home/bugz/public_html/vb/admin/functions.php on line 1660
i am runnign 2.2.6 php version 4.2.1 . any ideas ?
Originally posted by Bugz Fatal error: Cannot redeclare vbdatenoty() (previously declared in /home/bugz/public_html/vb/admin/functions.php:1633) in /home/bugz/public_html/vb/admin/functions.php on line 1660
Hi Bugz,
The function vbdatenoty() isn't a standard vb function, so I'm guessing you probably pasted it twice without knowing it... or something. I made that function up, and named it, so if you didn't paste it twice, some other hack you installed decided to use that same name (although I wouldn't know why).
As for your second post, I can't see what you're talking about. I visited your forums, and the Last Visited date (the only recent date I can get) is working fine.
As cool as this hack is, I think you can take it a bit further.
I believe that people don't really have an idea how old a post is by looking at a date or timestamp. I think it would be much cooler to give them this kind of information:
1 minute old
5 minutes old
35 minutes old
1 hour old
5 hours old
2 days old
2 weeks old
etc....
Or maybe with the correct date between brackets, like this:
5 minutes old (07-07-2002 15:15).
Another feature of this "TIME POSTED AGO" hack could be that the admin can specify a period of when the normal date should be displayed again. For example, if a post is older than 1 month, then it will not display the '1 month old' message, but simple the date.
I've seen this feature on other boards, take a look for example at http://www.dpreview.com/forums/forum.asp?forum=1002 (it's not a vb board though), it seems like it works very well there, and you get an immediate idea of how old posts are.
Originally posted by PeterNRG As cool as this hack is, I think you can take it a bit further.
I believe that people don't really have an idea how old a post is by looking at a date or timestamp. I think it would be much cooler to give them this kind of information:
1 minute old
5 minutes old
35 minutes old
1 hour old
5 hours old
2 days old
2 weeks old
etc....
Or maybe with the correct date between brackets, like this:
5 minutes old (07-07-2002 15:15).
Another feature of this "TIME POSTED AGO" hack could be that the admin can specify a period of when the normal date should be displayed again. For example, if a post is older than 1 month, then it will not display the '1 month old' message, but simple the date.
I've seen this feature on other boards, take a look for example at http://www.dpreview.com/forums/forum.asp?forum=1002 (it's not a vb board though), it seems like it works very well there, and you get an immediate idea of how old posts are.
What do you think? Am I making any sence ?
i dont know php nor asp but i do know that there totally diffrent type of programming. so i assume it would be maby difficult to do this in a vb (php) prgramming
Yes, I figured that one out. You're only seeing "Today, at ______" because you must have applied the "at" variation to this hack (found here) somewhere other than the "Last visited" date.
You can't use the "at" modification within vbdate() itself -- not the way vB is written. You should only use the "at" modification in specific places where you want to see "at". It isn't appropriate in many places because vB only passes a date -- and not a time -- to many displayed dates throughout the system.