• Welcome to XF2 Addons

    You can purchase a Premium membership for only $35 per year, and this gives you access to download any or ALL of the over 400 add-ons developed for Xenforo 2.x. In addition, Premium members will get technical support. Once the Premium membership has expired you can continue to use the installed addons on your forum as long as you like.
Country flag

Country flag 1.9

No permission to download
Note
Compatible XF 2.x versions: 2.2.6 and newer.
Description:

Shows a country flag in the message user info block.

(Example of country flag)

pic001.jpg


(Example of Privacy page)

pic002.jpg


(Example of Options page)

pic003.jpg


(Example of User group permissions)

pic004.jpg


Features:
  • Privacy option allows members to not show their country flag.
  • All phrases start with countryflag_ for your convenience.
Setup step 1:

Create a /misc/flags/shiny/32/ directory in your web root.

Setup step 2:

Copy the files from the /flags/shiny/32/ located in the Country flag add-on directory to the /misc/flags/shiny/32/ directory you created in Setup step 1.

Setup step 3:

Update the Country flag Options page with the Image link.

Setup step 4:

Give User group permissions to view the country flag:

Registered = Yes
Unregistered / Unconfirmed = Yes

Setup step 5:

Run the Cron entry for the Country flag manually, this is only required upon initial setup. The Cron entry will run run once a day at 12:00AM UTC.

Database modifications:

This add-on will create two columns in your xf_user table:

andy_country_flag_name
andy_country_flag_display

Questions and Answers:

Q: When I hover the flag with my mouse, the filename is displayed in English, can I phrase this to show the filename in another language?
A: No.

Q: What does the 'Last activity days' in the options page do?
A: This value is used when the Cron entry runs.

Q: How is the country determined?
A: The ipapi.co API is used. They have a set limit of 1000 API calls per 24 hours, so it might take a few days to update all your members.

Q: When does the Cron entry run?
A: It runs once a day at 12:00AM UTC time.

Q: When the Cron entry runs, which members will have their country looked up?
A: Only new members which have an empty andy_country_flag_name field.

Q: Is there an option to make the add-on opt-in instead of opt-out?
A: No. Opt-in does not work, member will not take the time to opt-in.

Q: Is there a way I can update all the members country flags?
A: Yes. You can add the following to your forum URL:

countryflag/updateall

The next time the Cron entry runs it will update all your members country flags. Keep in mind inactive members will not be updated, this is a setting in the options page.
  • Like
Reactions: Robru
Author
Andy
Downloads
150
Views
2,163
First release
Last update
Rating
5.00 star(s) 1 ratings

Latest updates

  1. See description

    Country flag v1.9 changes: Removed unused Image path in options page.
  2. See description

    Country flag v1.8 changes: Now using ipapi.co for country lookup.
  3. See description

    Country flag v1.7 changes: Now compatible with XF 2.2.6 and newer.

Latest reviews

Great addon!

Similar resources

Country flag select Andy
Allows members to select their country flag.
0.00 star(s) 0 ratings
Downloads
77
Updated
Country access check Andy
Blocks access to Contact us, Log in and Register pages from specified countries.
5.00 star(s) 1 ratings
Downloads
27
Updated
Country restricted page Andy
Allows page access only to countries specified in options page.
5.00 star(s) 1 ratings
Downloads
30
Updated
Top