Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Aug 2000
Posts: 335
Member
Member
Offline
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.

Sponsored Links
Joined: Feb 2000
Posts: 4,625
Member
Member
Offline
Joined: Feb 2000
Posts: 4,625
Nice to see someone is doing this!

GetDateTime() in ubb_lib_time may contain what you want.

Code
code:

hint hint. wink

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
Offline
Joined: Aug 2000
Posts: 335
Thanks smile

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
Offline
Joined: Feb 2000
Posts: 4,625
bumping for ideas.

Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
Code
code:

DOH! just realized that that would check against the time the thread was last posted or replied to, thats not gonna work. frown

[ June 10, 2001 08:49 PM: Message edited by: jordo ]

Sponsored Links
Joined: Aug 2000
Posts: 335
Member
Member
Offline
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
Offline
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
Offline
Joined: Aug 2000
Posts: 335
Quote
quote:
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 ]


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
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,575
Posts293,931
Members13,824
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,834
Greg Hard 4,625
Top Posters(30 Days)
Gizmo 1
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)