From 646b70c38677863aa4bbcb3302c1237a8b1e4cf1 Mon Sep 17 00:00:00 2001 From: IanM Date: Mon, 9 Sep 2024 10:45:13 +0100 Subject: [PATCH] feat: add support for fof/default-user-preferences --- composer.json | 3 ++- extend.php | 6 ++++++ resources/locale/en.yml | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index eff8e29..ec2480e 100644 --- a/composer.json +++ b/composer.json @@ -64,7 +64,8 @@ }, "require-dev": { "flarum/phpstan": "*", - "fof/drafts": "*" + "fof/drafts": "*", + "fof/default-user-preferences": "*" }, "scripts": { "analyse:phpstan": "phpstan analyse", diff --git a/extend.php b/extend.php index f190077..cd1ced4 100644 --- a/extend.php +++ b/extend.php @@ -69,4 +69,10 @@ (new Extend\User()) ->registerPreference('showIPCountry', 'boolval', false), + + (new Extend\Conditional()) + ->whenExtensionEnabled('fof-default-user-preferences', fn() => [ + (new \FoF\DefaultUserPreferences\Extend\RegisterUserPreferenceDefault()) + ->default('showIPCountry', false, 'bool'), + ]), ]; diff --git a/resources/locale/en.yml b/resources/locale/en.yml index 6ea32a8..52af7c8 100644 --- a/resources/locale/en.yml +++ b/resources/locale/en.yml @@ -46,3 +46,9 @@ fof-geoip: user: settings: ip_country: Show the flag of the country I post from, based on my IP address + +fof-default-user-preferences: + admin: + settings: + showIPCountry: Show the flag of the country the user posts from + showIPCountry-help: This is based on their IP address at the time of posting. The country flag (if enabled) will be visible to all users. Admin users and moderators will see the IP address in the tooltip. \ No newline at end of file