Advertisement:

Author Topic: [MOD][PENDING] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x  (Read 18700 times)

Offline ahrasis

  • SMF Hero
  • ******
  • Posts: 4,921
  • Gender: Male
  • Busy mode is on.
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • ElkArte Malaysia
I am opening this topic in response to a need for a better mod that could provide relative times and dates for SMF forum. This mod is for both SMF 1.1.x and 2.0.x.

Love this mod, but can we have it so that it has things like "about a month ago" and "about a a year ago" rather than defaulting to, say, June 12, 2014, 10:52:15 AM if there isn't anything within a recent timeframe? Or can I add this myself somehow?

I already wrote a similar mod which is pending approval. You can have a try from my github repository https://github.com/ahrasis/Improved-Displayed-Times-Mod.

As mentioned I already wrote a similar mod which is pending approval. You can have a try from my github repository https://github.com/ahrasis/Improved-Displayed-Times-Mod.

There is a minor bug in this mod which I am attending to. This mod should be on the SMF mod approved list soonest as the bug being eliminated.

Enjoy!

Edited: The mod is attached in post #4 & #8 below for interested tester. Install at your own risk! ;):
1. With Times Details
2. Without Times Details




http://www.simplemachines.org/community/index.php?action=dlattach;topic=525151.0;attach=233247;image
« Last Edit: July 16, 2014, 09:16:19 AM by ahrasis »

Offline ahrasis

  • SMF Hero
  • ******
  • Posts: 4,921
  • Gender: Male
  • Busy mode is on.
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • ElkArte Malaysia
Re: [WIP] - Improved Displayed Times Mod
« Reply #1 on: July 14, 2014, 07:59:49 PM »
Love this mod, but can we have it so that it has things like "about a month ago" and "about a a year ago" rather than defaulting to, say, June 12, 2014, 10:52:15 AM if there isn't anything within a recent timeframe? Or can I add this myself somehow?

I already wrote a similar mod which is pending approval. You can have a try from my github repository https://github.com/ahrasis/Improved-Displayed-Times-Mod.

This works really well so far, I can't believe this happened, I'm so impressed! One question, when I return to the forum after making a test post, it shows non-relative times, is this a cache issue? Also, topics and posts made before I uninstalled the old relative times and installed your new one say things like "5 days ago at 06:43:29 PM", is it supposed to have the "at 06:43:29 PM" part, or is this because they were posted without your mod installed? Is there a way of changing this so all posts show your relative times?

The "at 06:43:29 PM" part should already be an integrated part of the mod for all times and dates after 24 hours. Only if it is below 24 hours, no specific time will be mentioned.

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,101
    • @studyforceps on Twitter
    • Study Force
Re: [WIP] - Improved Displayed Times Mod
« Reply #2 on: July 14, 2014, 10:52:25 PM »
A 1.x version too, cool!

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,101
    • @studyforceps on Twitter
    • Study Force
Re: [WIP] - Improved Displayed Times Mod
« Reply #3 on: July 14, 2014, 11:16:56 PM »
Discovered some issues on my 1.x forum:

Offline ahrasis

  • SMF Hero
  • ******
  • Posts: 4,921
  • Gender: Male
  • Busy mode is on.
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • ElkArte Malaysia
Re: [WIP] - Improved Displayed Times Mod
« Reply #4 on: July 14, 2014, 11:38:25 PM »
Thank you for testing. I am also doing some testing here to make sure it is problem-bug-and-error free. Attached is the mod with its latest fix. Please update in here if there is any more problem(s).
« Last Edit: July 15, 2014, 01:59:24 AM by ahrasis »

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,101
    • @studyforceps on Twitter
    • Study Force
Re: [WIP] - Improved Displayed Times Mod
« Reply #5 on: July 15, 2014, 12:08:22 AM »
Still needs a bit of work. Those issues have been fixed, but now all the other dates are showing up standard.

Offline ahrasis

  • SMF Hero
  • ******
  • Posts: 4,921
  • Gender: Male
  • Busy mode is on.
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • ElkArte Malaysia
Re: [WIP] - Improved Displayed Times Mod
« Reply #6 on: July 15, 2014, 12:42:11 AM »
Thanks to the highlight by Shuban, I have detected the cause of that problems. The default code which were used together in this mod limits the definition of today as at the date of today and not a time within 24 hours from the date post was made and recorded.

Code: [Select]
if ($then['yday'] == $now['yday'] && $then['year'] == $now['year'])
Thus, time that passed after today's date wasn't changed and the date is not covered by the mod code. As such, I have the code to cover that period as well. The file attached in post #4 is the fixed copy.

This is now tested live in http://anypost.qom.my for SMF 2.0.x. I haven't got any file with data for SMF 1.1.x, so I can only test it in a newly made forum with limited period of time. Feel free to ask for support, if you are testing this mod.
« Last Edit: July 15, 2014, 02:07:39 AM by ahrasis »

Offline samborabora

  • Full Member
  • ***
  • Posts: 517
Re: [WIP] - Improved Displayed Times Mod
« Reply #7 on: July 15, 2014, 05:06:25 AM »
Love this mod, but can we have it so that it has things like "about a month ago" and "about a a year ago" rather than defaulting to, say, June 12, 2014, 10:52:15 AM if there isn't anything within a recent timeframe? Or can I add this myself somehow?

I already wrote a similar mod which is pending approval. You can have a try from my github repository https://github.com/ahrasis/Improved-Displayed-Times-Mod.

This works really well so far, I can't believe this happened, I'm so impressed! One question, when I return to the forum after making a test post, it shows non-relative times, is this a cache issue? Also, topics and posts made before I uninstalled the old relative times and installed your new one say things like "5 days ago at 06:43:29 PM", is it supposed to have the "at 06:43:29 PM" part, or is this because they were posted without your mod installed? Is there a way of changing this so all posts show your relative times?

The "at 06:43:29 PM" part should already be an integrated part of the mod for all times and dates after 24 hours. Only if it is below 24 hours, no specific time will be mentioned.

This is so cool, btw, that you made this mod, I still can't believe it cause I wanted one so badly! Could there be a setting available in CP to only show the friendly date part without any of the additional date part? So it just says "5 minutes ago", "3 days ago", "2 months ago", "3 years ago", etc?

Offline ahrasis

  • SMF Hero
  • ******
  • Posts: 4,921
  • Gender: Male
  • Busy mode is on.
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • ElkArte Malaysia
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #8 on: July 15, 2014, 05:17:17 AM »
That would be easier and it is done. Attached (with edited as noted in the post below).
« Last Edit: July 15, 2014, 05:49:29 AM by ahrasis »

Offline samborabora

  • Full Member
  • ***
  • Posts: 517
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #9 on: July 15, 2014, 05:22:56 AM »
That would be easier and it is done. Attached.

Awesome, I just installed the new one:

Code: [Select]
Template Parse Error!

There was a problem loading the /Themes/default/languages/Modifications.english.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.
syntax error, unexpected T_STRING

Just changed it to:

Code: [Select]
$txt['itv_years'] = ' years ago';
$txt['itv_months'] = ' months ago';
$txt['itv_weeks'] = ' weeks ago';
$txt['itv_days'] = ' days ago';
$txt['itv_hours'] = ' hours ago';
$txt['itv_minutes'] = ' minutes ago';
$txt['itv_year'] = ' A year ago';
$txt['itv_month'] = ' A month ago';
$txt['itv_week'] = ' A week ago';
$txt['itv_day'] = ' A day ago';
$txt['itv_hour'] = ' An hour ago';
$txt['itv_minute'] = ' A minute ago';
$txt['itv_second'] = ' Just now!';

WORKS PERFECTLY, so far, I cannot thank you enough for this, I'll keep testing and let you know if there are any other issues ;)

Offline ahrasis

  • SMF Hero
  • ******
  • Posts: 4,921
  • Gender: Male
  • Busy mode is on.
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • ElkArte Malaysia
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #10 on: July 15, 2014, 05:52:29 AM »
Thank you for testing and pointing the error. I fixed it and attached the new one.

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,101
    • @studyforceps on Twitter
    • Study Force
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #11 on: July 15, 2014, 03:17:03 PM »
This works flawlessly. Thank you for dedicating the time to creating this.

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #12 on: July 15, 2014, 04:01:08 PM »
Cool idea. Nice job.

Offline samborabora

  • Full Member
  • ***
  • Posts: 517
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #13 on: July 15, 2014, 04:51:49 PM »
I want to say once more, thank you for taking the time out to do this, I am so pleased with finally having completely friendly tiimes!!

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,101
    • @studyforceps on Twitter
    • Study Force
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #14 on: July 15, 2014, 04:58:39 PM »
One small request that I've always wanted.

Sometimes I have posts made @ 11:56 PM and then when it turns 12:01 AM, for instance, the timing of that post automatically becomes "A day ago". Is it possible to prevent this from happening because one minute past midnight isn't necessarily 'a day ago', if you know what I mean.

Offline ahrasis

  • SMF Hero
  • ******
  • Posts: 4,921
  • Gender: Male
  • Busy mode is on.
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • ElkArte Malaysia
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #15 on: July 15, 2014, 09:19:32 PM »
Thanks you for the feedbacks.

One small request that I've always wanted.

Sometimes I have posts made @ 11:56 PM and then when it turns 12:01 AM, for instance, the timing of that post automatically becomes "A day ago". Is it possible to prevent this from happening because one minute past midnight isn't necessarily 'a day ago', if you know what I mean.

Well it is always possible to modify the mod to suit any need.

Currently, the mod has between:
- Just now!
- 1 minute ago
- 2-59 minutes ago
- 1 hour ago
- 2-23 hours ago
- 1 day ago
- 2-6 days ago
- 1 week ago
- 2-3 weeks ago
- 1 month ago
- 2-11 months ago
- 1 year ago
- 2-unlimited years ago

If you mean to maintain the time, well, we already have two versions:
1. With Times Details @ post#4
2. Without Times Details @ post#8

If you need it modified in some way(s), I will need to know what you actually wish to accomplish so that I can advise the necessary changes.

Note: Errors that you previously posted was already been fixed in both versions.

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,101
    • @studyforceps on Twitter
    • Study Force
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #16 on: July 16, 2014, 12:24:46 AM »
My apologies, it works wonderfully.

@ahrasis, do you take on personal SMF mod requests for cash?

Offline ahrasis

  • SMF Hero
  • ******
  • Posts: 4,921
  • Gender: Male
  • Busy mode is on.
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • ElkArte Malaysia
Re: [WIP] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #17 on: July 16, 2014, 02:36:17 AM »
Thank you.

And no. I don't take any cash for personal SMF mod requests. SMF coding is only my hobby.

There are people who is doing this here and you may get that help for free or paid at this board:
http://www.simplemachines.org/community/index.php?board=50.0

Offline ahrasis

  • SMF Hero
  • ******
  • Posts: 4,921
  • Gender: Male
  • Busy mode is on.
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • ElkArte Malaysia
Re: [MOD][PENDING] - Improved Displayed Times Mod for SMF 1.1.x and 2.0.x
« Reply #18 on: July 17, 2014, 04:35:31 PM »
Improved Displayed Times (Facebook Styles) mod is already approved. You can get its package or support as stated below. I am locking this topic now.

1. Improved Displayed Times (Facebook Styles) Mod Package
2. Improved Displayed Times (Facebook Styles) Mod Support

Thank you for your feedback and support.