|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
I'm working on a hack to suppress the "edited by" annotation that's added to a post, if the editing is performed within 15 minutes of the time that the original message was posted.
This hack doesn't already exist, does it?
The only thing I need is to determine whether a date/time in the format ('02-16-2001', '10:11 AM') is within 15 minutes of the current time. I know how to do this using Time::Local, but I was wondering whether the UBB already contains subs for comparing date/times in that format. I've looked at ubb_lib_time.cgi, but the lack of documentation makes it difficult to figure out what the subs do.
|
|
|
|
Joined: Feb 2000
Posts: 4,625
Member
|
Member
Joined: Feb 2000
Posts: 4,625 |
Nice to see someone is doing this! GetDateTime() in ubb_lib_time may contain what you want. hint hint. Check to see if the time it was posted matches the 15 minutes you want... Time::Local is a good idea and very easy to use, but is it standard in perl?
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
Thanks  GetDateTime appears to just fill in the contents of %GotTime. I know what some of the fields are. I guess I'll just print out the other ones to see what they are. Although, it occurred to me that rather than using Time::Local to convert ('02-16-2001', '10:11 AM') to time() format, I could use localtime() or gmtime() to convert the current time minus 15 minutes to a string, and then just do a string compare.
|
|
|
|
Joined: Feb 2000
Posts: 4,625
Member
|
Member
Joined: Feb 2000
Posts: 4,625 |
|
|
|
|
Joined: Aug 2000
Posts: 874
Moderator / Developer
|
Moderator / Developer
Joined: Aug 2000
Posts: 874 |
DOH! just realized that that would check against the time the thread was last posted or replied to, thats not gonna work. [ June 10, 2001 08:49 PM: Message edited by: jordo ]
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
I determined that it's easy to do this, with one complication.
My plan is to add the hack to ubb_edit_post.cgi/sub perforum_edit(). The date and time of the original post are available in $post_info[3] and $post_info[4]. The format of those values is determined by the date/time settings in the control panel (that's the complication).
I haven't decided whether to write the hack for a single format, or make it general enough to handle any selected format. I'm also not sure whether changing the control panel date/time format setting would require a cache-clear, to avoid confusing the hack.
In any case, I would convert $post_info[3] and $post_info[4] to the format YYYY-MM-DD-HH-MM (year-month-day-hour-minute), get the current date/time less 15 minutes in that same format, and then do a simple string compare to determine whether to suppress the "edited by" annotation.
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
I've finished this hack. Would you like me to publish it here? If so, are there any guidelines or examples for doing that?
It probably should be considered a beta hack, until other people have tested it.
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
I was incorrect here. The format is always US AM/PM: '06-23-2001', '06:32 PM'. This makes the hack much simpler and more reliable. [ June 23, 2001 05:30 PM: Message edited by: Dave_L ]
|
|
|
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.
|
|
Posts: 87
Joined: December 2001
|
|
Forums63
Topics37,575
Posts293,931
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|