Resource icon

User Date/Time Format Settings 1.1.1

No permission to download

CmptrWz

Member
CmptrWz submitted a new resource:

User Date/Time Format Settings - Allow users to choose individual Date and Time Formats

My first addon, targeted at my own annoyance for being dependent on the Language options for date and time formats.

Allows users to override the language-level date and time format settings.

Adds two new User Custom Fields:
  1. Preferred Date Format
    • All (non-custom) formats from the admin panel
    • Full-year m/d/y and d/m/y formats
    • ISO 8601 YYYY-MM-DD format
  2. Preferred Time Format
    • 12 and 24 hour formats
They are both optional and...

Read more about this resource...
 
I added custom lines, to

setup.php
Code:
            $userDate->field_choices = [
                'day_full_date' => 'Tuesday - 29.09.2020',

...

            $userTime->field_choices = [
                '12h' => '7:30 PM',
                '24h' => '19:30',
                '24h_with_seconds' => '19:30:21'
            ];

Language.php

Code:
    private $cw_date_formats = [
        'day_full_date' => 'l - d.m.Y',
        
...
        
    private $cw_time_formats = [
        '12h' => 'g:i A',
        '24h' => 'H:i',
        '24h_with_seconds' => 'H:i:s'
    ];

Well, before installing I had warning to review warnings and when I confirmed to continue, everything seems OK. Is it fine to add new lines like this or should I did something differently?
 
I imagine that the warnings were due to the hash mismatches on the addon files compared to the hashes.json file, otherwise that should be fine.
 
@Alan_SP BTW, if all you're looking for is having that date and time format, you could just put those into your language config as the defaults and not need an addon at all. Or leave the addon for people who want to choose otherwise.
 
I imagine that the warnings were due to the hash mismatches on the addon files compared to the hashes.json file, otherwise that should be fine.
Yes, I have got even file check tampering warnings now on server. How to get my version to have hashes? I'll include my version, if you could help me with this.

Is there an easy way for me to create correct hashes, so I can do this myself?

Or, there should be an easy way to edit time formats to customize it to our liking.

I hope this could be solved, that I don't get this file check warnings.
 

Attachments

Thanks, sorted it out with help of this thread. Now I have version with everything correct, from file hashes point of view. And addon works.

It would be very useful if you find way that we can manually changed time stamps to suite our needs.
 
This add-on crashes (again) the forum after XF2.2.1 is installed. Had to disable the listener and uninstall this add-on.

The bad thing is.. the following options are still there in users' references.

1602744468844.webp
 
This add-on crashes (again) the forum after XF2.2.1 is installed. Had to disable the listener and uninstall this add-on.
Which version of the addon are you using? The latest version seems to work fine on 2.2.1 for me right now.

As for the custom user fields, those can be disabled/removed from the Users -> Custom User Fields admin page.
 
Yes i reported this problem with another add-on last week I guess. And you fixed it shortly.

But today after installing the latest XF2.2.1, it crashed again. I needed to repeat everything I did last time to have my forum back.

Maybe I can install your add-on now and see what happens.
 
Just tried reinstalling the addon. Seems no problem. And uninstalled it. The above options in account preferences are still there.

So a complete uninstallation is not possible for this addon?

Using 1.0.1
 
The Custom User Fields can be deleted at any time with the admincp, even while the addon is installed (if, say, you don't want people changing the date format but are happy with them changing the time format).
 
I added custom lines, to

setup.php
Code:
            $userDate->field_choices = [
                'day_full_date' => 'Tuesday - 29.09.2020',

...

            $userTime->field_choices = [
                '12h' => '7:30 PM',
                '24h' => '19:30',
                '24h_with_seconds' => '19:30:21'
            ];

Language.php

Code:
    private $cw_date_formats = [
        'day_full_date' => 'l - d.m.Y',
 
...
 
    private $cw_time_formats = [
        '12h' => 'g:i A',
        '24h' => 'H:i',
        '24h_with_seconds' => 'H:i:s'
    ];

Well, before installing I had warning to review warnings and when I confirmed to continue, everything seems OK. Is it fine to add new lines like this or should I did something differently?
Completely removed this plugin from the server (and files)
Changed files. Installed.
But nothing happened :(

1665476486534.png


Checked the code at /src/addons/CmptrWz/UserDateTime/...
New code :(


Completely removed again.
Install "CmptrWz-UserDateTime-1.0.0_b.zip" (Could not process CmptrWz-UserDateTime-1.0.0_b.zip: File does not appear to be a valid add-on archive as expected.)
Fixed folder.
Install.
Nothing happened :(


Rebuild user caches
Nothing happened :(


Mystic...
 
Last edited:
I'm not sure what's going on. I just wish that Xenforo add feature where we can choose our own date format, like it's on vB or phpBB.
 
  • Like
Reactions: Xon
Back
Top Bottom