Just a simple little modification for those of us who want our users to be able to select what country they are from. This tutorial will save you a fair bit of time when setting it up.
*Note: The country list WILL NOT be maintained and this IS NOT SUPPORTED in any way, shape or form. This is simply a tutorial to make adding countries easier.
The Setup Process
The setup process is pretty straight forward, but make sure you have access to FTP and phpMyAdmin before you get started.
- Step 1: Setting Up the Flag Sprites
- Download the attached file "flag-sprites.zip" and upload the "styles" directory into your root XenForo directory.
- Login to the Admin CP and within the admin search find "Extra.css". Paste the contents of flags.css into that template and save.
- Step 2: Setting Up the Custom Field
- Login to the Admin CP and head to "Custom Fields" under the "User" tab.
- Click on "Create New Field" and enter the following information in.
- Under "Basic Information" add the following:
Field ID: country
Title: Country
Description: *Anything you want*
Display Location: Personal Details
Display Order: 100
Field Type: Drop Down Selection - Under "Options for Choice Fields" add the following:
Value: test
Text: Test - Under "General Options" do the following:
Check off any options you want to set for this field.
In Value Display, add the following:HTML:<img src="/styles/default/xenforo/clear.png" class="flag flag-{$choice}" alt="{$value}" /> {$value}
- Save this field.
- Step 3: Import the Countries via phpMyAdmin
- Login to phpMyAdmin and find your XenForo database.
- Insert the SQL code attached in "countries.txt" and run.
- Check your Country Field to see if the countries have been successfully added.
- Remove the "Test" option if it is still there.
- Step 4: Enjoy! Let me know of your success.
The flag icons are the property of famfamfam.com and I did not create them. The sprite image was provided by flag-sprites.com.
No comments:
Post a Comment