[3.3][RC] Filter by country - version 1.0.19

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
DSC
Registered User
Posts: 5
Joined: Wed Dec 16, 2020 5:23 pm
Location: Hamburg, Germany
Name: Dirk

Re: [3.3][RC] Filter by country - version 1.0.18

Post by DSC »

Hi!
I just installed your ingenious extension (PHP version 7.4.13, phpBB version 3.3.2). It works without any problems and does what it should. Thanks a lot for this great piece of software.

Anyway I did notice a small "phenomenon". If I allow (select) more than one country code, more than my selected country codes are automatically added. Example:
1. germany selected -- only the one entry is selected
2. Germany & Denmark selected -- these both entries + Congo are selected.
3. Germany & Denmark & United States selected -- these three entries + Congo + Cuba are selected.
4. Aland Islands & Germany & Denmark & United States selected -- these four entries + Cocos (Keeling) Islands + Congo + Cuba are selected.
etc.

Is this only a problem with the display? Or maybe black humour (USA --> Cuba!) ;-)
User avatar
MarkDHamill
Registered User
Posts: 4366
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.18

Post by MarkDHamill »

It sounds like you are selecting incorrectly. Hold down CTRL (or CMD on a Mac) to select an item in the list while retaining others in the list. If you hold the SHIFT key down you select a range between the last item selected and the latest item selected.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
DSC
Registered User
Posts: 5
Joined: Wed Dec 16, 2020 5:23 pm
Location: Hamburg, Germany
Name: Dirk

Re: [3.3][RC] Filter by country - version 1.0.18

Post by DSC »

Thanks for your fast reply. I forgot to say ... I made the test with Mac (CMD Key), Windows 10 (Crtl-Key) ans iOS (no key ;-) - It's the same funny multi-auto-wrong-select behaviour. And the wrong-auto-selected items are not near (in alphabetical order) to the on purpose selected ones, see examples below.
User avatar
MarkDHamill
Registered User
Posts: 4366
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.18

Post by MarkDHamill »

I don't see any examples. But the extension does nothing to change the behavior of how selecting is done in HTML <select> and <option> tags, so it's either something strange about your browser or your method of selecting individual countries is not what the browser is expecting.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
DSC
Registered User
Posts: 5
Joined: Wed Dec 16, 2020 5:23 pm
Location: Hamburg, Germany
Name: Dirk

Re: [3.3][RC] Filter by country - version 1.0.18

Post by DSC »

DSC wrote:
Wed Dec 16, 2020 5:40 pm
...Example:
1. germany selected -- only the one entry is selected
2. Germany & Denmark selected -- these both entries + Congo are selected.
3. Germany & Denmark & United States selected -- these three entries + Congo + Cuba are selected.
4. Aland Islands & Germany & Denmark & United States selected -- these four entries + Cocos (Keeling) Islands + Congo + Cuba are selected.
etc.
Hi, I have expressed myself in a misleading way. Sorry for that.
It is not a question of selecting 2 or 3 or more entries, but what is displayed after submitting the selection into action: If 2 entries were selected, 3 were displayed after the submission, with 3 selections there were 5, etc.
But anyway, I found a "work around": Instead of "Allow" I selected "Restrict", then selected all entries and de-selected the mentioned 3 (Germany, Denmark, USA). After submitting, the selection is as before (all but the 3 selected). Many thanks for your support. Your extension is really a very helpful tool.
User avatar
MarkDHamill
Registered User
Posts: 4366
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.18

Post by MarkDHamill »

There is a convenient "Unselect all country codes" button on the settings page for the extension.

Are you using the Dutch language pack? I don't think its language file has been updated for the latest version of this extension. Anyhow, I tested your behavior on my machine and I can't replicate it.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
DSC
Registered User
Posts: 5
Joined: Wed Dec 16, 2020 5:23 pm
Location: Hamburg, Germany
Name: Dirk

Re: [3.3][RC] Filter by country - version 1.0.18

Post by DSC »

Installed language packs are
1. British English 3.3.2 (as included in the default phpBB package 3.3.2) - used by 0
2. German (Casual Honorifics) 3.3.2 - used by 93
I.e. the pphBB with its ACPs are in German (necessary since the majority of my board users are native GERs with limited EN language skills ... ;-) ), Extensions use "de" (when provided and installed) or the default "en". FBC is in the latter category.

Board style is "we_universal" (2.6.4 = latest version for 3.3), based on prosilver (3.3.2)

In the standard ACPs I cannot find any example for multi-select lists with initially preselected entries (e.g. adding / deleting IPs to / from the board blacklist has no preselections), so I cannot compare if the behaviour mentionned is e.g. a DE language pack problem or not. But I will try to further investigate this behaviour myself. But for now, I have a working solution which works really magically. Once again thanks a lot for your support.
User avatar
MarkDHamill
Registered User
Posts: 4366
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.18

Post by MarkDHamill »

I have forgotten someone recently provided a German language pack translation. It was provided in June but I don't believe it's been updated so the common.php language file is probably out of date. The problem is probably there. You can test by removing it, purging the cache and using the British English version with the extension. On the advice of the phpBB Extensions review team, country names are no longer inside of an array.

https://github.com/MarkDHamill/filterby ... p#L51-L300
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
RemmyH
Registered User
Posts: 12
Joined: Sat Dec 13, 2008 8:39 am

Re: [3.3][RC] Filter by country - version 1.0.18

Post by RemmyH »

I installed the mod in my phpbb site and set 3 countries to be blocked
- Russia
- Ukraine
- Belarus

But the mod automatically also set
- Cocos Islands
- Costa Rica
- Cuba
which I can't undo.

Is this a bug or is there another reason?
User avatar
MarkDHamill
Registered User
Posts: 4366
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.18

Post by MarkDHamill »

I apologize. There is a bug and its root is the encoding of a comma delimited list of country codes. It can be fixed as follows:

Change /adm/style/event/acp_overall_footer_after.html, lines 7-8 from:

Code: Select all

		var countryCodes = escape("{{ COUNTRY_CODES }}");
		var countryCodesArray = encodeURIComponent(countryCodes.split(','));
to:

Code: Select all

		var countryCodes = decodeURIComponent("{{ COUNTRY_CODES }}");
		var countryCodesArray = countryCodes.split(',');
Also change controller/acp_controller.php line 215 from:

Code: Select all

				'COUNTRY_CODES' 					=> $this->config_text->get('phpbbservices_filterbycountry_country_codes'),	// Processed by the Javascript
to:

Code: Select all

				'COUNTRY_CODES' 					=> urlencode($this->config_text->get('phpbbservices_filterbycountry_country_codes')),	// Processed by the Javascript
Afterward, purge the cache.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4366
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.18

Post by MarkDHamill »

Side note: if you selected "Unselect all country codes" and then selected your countries, and saved the settings, the appropriate countries were saved to the database. The error is due to escaping a comma delimited list of country codes. The comma gets translated into something that is URL encoded and that's where it broke down. I'll try to release a new version today with this and a couple of other minor bug fixes.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
RemmyH
Registered User
Posts: 12
Joined: Sat Dec 13, 2008 8:39 am

Re: [3.3][RC] Filter by country - version 1.0.18

Post by RemmyH »

Thanks, the fix seems to be working fine.
User avatar
DSC
Registered User
Posts: 5
Joined: Wed Dec 16, 2020 5:23 pm
Location: Hamburg, Germany
Name: Dirk

Re: [3.3][RC] Filter by country - version 1.0.18

Post by DSC »

MarkDHamill wrote:
Sat Dec 19, 2020 3:19 am
There is a bug and its root is the encoding of a comma delimited list of country codes. It can be fixed as follows:

Change /adm/style/event/acp_overall_footer_after.html, lines 7-8 ...

Also change controller/acp_controller.php line 215 ...

Afterward, purge the cache.
I've patched the v1.0.18 accordnigly and the "problem" I've reported before is gone. Now selections are shown as submitted. Thanks a lot! Looking forward to the official v1.0.19 :-)
User avatar
MarkDHamill
Registered User
Posts: 4366
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

[3.3][RC] Filter by country - version 1.0.19 released

Post by MarkDHamill »

Version 1.0.19 is now available for download. Summary of changes:
  • Fixed subtle error that caused some countries on the settings page to be selected when they were not explicitly selected. This was caused by URL encoding the country codes.
  • Removed the duplicate 'AF' and 'AX' country codes from the constant FBC_COUNTRY_CODES
  • Replaced the LOG_CRITICAL constant in critical log entries stored with 'critical'. This approach seems strange to me, but that's what the review team wanted.
The extension can be downloaded here or from the GitHub 1.0.19 release branch. If downloaded from GitHub, make sure to place the files in /ext/phpbbservices/filterbycountry.

The GitHub for the project is here:

https://github.com/MarkDHamill/filterbycountry
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
RemmyH
Registered User
Posts: 12
Joined: Sat Dec 13, 2008 8:39 am

Re: [3.3][RC] Filter by country - version 1.0.19

Post by RemmyH »

Is there a Dutch translation available somewhere?
I came across a link somewhere but that site doesn't exist anymore.
Post Reply

Return to “Extensions in Development”