Country Flags for Xenforo 2

VIPR

Founder
Administrator
Messages
284
Reaction score
138
Points
93
Best answers
0
PSN
VIP-Racing
Country
Australia
This tutorial will help you add a "Country" field to your forum so your users can easily select their country of origin and have a flag show in their profile and messages.

** BACK UP YOUR SQL DATABASE NOW **

Step 1: Download resource and upload the files to the root of your forum installation.
Step 2: Login to your Admin CP and find the "extra.less" template. Add the following code to the bottom of this template:
Code:
.flag {
background:url(/styles/default/xenforo/flags/{$choice}.gif) no-repeat;
height:16px;
width:25px;
margin-top: 4px;
}
Step 3: While still logged into the Admin CP, head to "Users" > "User Custom Fields" and "Create a New Field" with the following settings:

  • Field ID: country
  • Title: Country
  • Description: Show other users where you're from.
  • Field Type: Drop down selection
  • Option for Possible choices: Add "test" and text of "Test".
  • General Options: Set the "Value Display HTML" to:
Code:
<img src="/styles/default/xenforo/flags/{$choice}.gif" class="flag flag-{$choice}" alt="{$value}" />
Step 4:Login to your Control Panel and access phpMyAdmin. Find your XenForo database and locate the table called "xf_user_field". Click edit, go down to field_choices, click browse and upload the file "xf_user_field-field_choices" and hit Go.
 
Last edited:

Romer

VIPR Member
Member
Messages
1
Reaction score
0
Points
1
Best answers
0
Country
Venezuela
Hello, good evening.

Sorry, where is the xf_user_field-field_choices file? could you help me with this info?

Thanks!
 

VIPR

Founder
Administrator
Messages
284
Reaction score
138
Points
93
Best answers
0
PSN
VIP-Racing
Country
Australia
Hello, good evening.

Sorry, where is the xf_user_field-field_choices file? could you help me with this info?

Thanks!
Hi mate, unfortunately you have to manually add the countries in admincp at this point.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Thread starter Similar threads Forum Replies Date
VIPR VIPR Multimedia 0

Similar threads

Top