Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember General Questions › Member Registration: country list, possible to modify?
- This topic has 16 replies, 5 voices, and was last updated 6 years ago by amuck1.
-
AuthorPosts
-
July 10, 2014 at 3:10 pm #11158jurgenvtMember
Hi, I was wondering if i can modify the list with countries in the registration form?
i basically need 3 or for and one “other”. i also would like to have one as standard selected.
thank you!
July 10, 2014 at 9:40 pm #64243wzpModeratorThey are hard coded… 8(
- Edit the eMember_misc_functions.php file.
- Look for the emember_country_list_dropdown() function.
- Edit as applicable.
July 11, 2014 at 1:27 am #64244adminKeymasterIs it missing any country from the list? If it is we will add them. Which ones are missing?
We can also add a filter there if it will help. Let me know if you want that.
July 11, 2014 at 8:59 am #64245jurgenvtMemberHi,
thank you wzp, i will check it out.
@admin: no i don’t think a country is missing, but 99.999999% of my members will reside in the netherlands, the rest in belgium, germany and otherso i will not be needing this extensive list.
July 11, 2014 at 9:06 am #64246jurgenvtMemberfound this:
function emember_country_list_dropdown($select = “”) {
$countries = array(“”, “Afghanistan”, “Albania”, “Algeria”, “Andorra”, “Angola”, “Antigua and Barbuda”, “Argentina”, “Armenia”, “Australia”,
“Austria”, “Azerbaijan”, “Bahamas”, “Bahrain”, “Bangladesh”, “Barbados”, “Belarus”, “Belgium”, “Belize”, “Benin”, “Bhutan”, “Bolivia”,
“Bosnia and Herzegovina”, “Botswana”, “Brazil”, “Brunei”, “Bulgaria”, “Burkina Faso”, “Burundi”, “Cambodia”, “Cameroon”, “Canada”, “Cape Verde”,
“Central African Republic”, “Chad”, “Chile”, “China”, “Colombi”, “Comoros”, “Congo (Brazzaville)”, “Congo”, “Costa Rica”, “Cote d’Ivoire”,
“Croatia”, “Cuba”, “Cyprus”, “Czech Republic”, “Denmark”, “Djibouti”, “Dominica”, “Dominican Republic”, “East Timor (Timor Timur)”, “Ecuador”,
“Egypt”, “El Salvador”, “Equatorial Guinea”, “Eritrea”, “Estonia”, “Ethiopia”, “Fiji”, “Finland”, “France”, “Gabon”, “Gambia, The”, “Georgia”,
“Germany”, “Ghana”, “Greece”, “Grenada”, “Guatemala”, “Guinea”, “Guinea-Bissau”, “Guyana”, “Haiti”, “Honduras”, “Hungary”, “Iceland”, “India”,
“Indonesia”, “Iran”, “Iraq”, “Ireland”, “Israel”, “Italy”, “Jamaica”, “Japan”, “Jordan”, “Kazakhstan”, “Kenya”, “Kiribati”, “Korea, North”,
“Korea, South”, “Kuwait”, “Kyrgyzstan”, “Laos”, “Latvia”, “Lebanon”, “Lesotho”, “Liberia”, “Libya”, “Liechtenstein”, “Lithuania”, “Luxembourg”,
“Macedonia”, “Madagascar”, “Malawi”, “Malaysia”, “Maldives”, “Mali”, “Malta”, “Marshall Islands”, “Mauritania”, “Mauritius”, “Mexico”, “Micronesia”,
“Moldova”, “Monaco”, “Mongolia”, “Morocco”, “Mozambique”, “Myanmar”, “Namibia”, “Nauru”, “Nepa”, “Netherlands”, “New Zealand”, “Nicaragua”, “Niger”,
“Nigeria”, “Norway”, “Oman”, “Pakistan”, “Palau”, “Panama”, “Papua New Guinea”, “Paraguay”, “Peru”, “Philippines”, “Poland”, “Portugal”, “Qatar”,
“Romania”, “Russia”, “Rwanda”, “Saint Kitts and Nevis”, “Saint Lucia”, “Saint Vincent”, “Samoa”, “San Marino”, “Sao Tome and Principe”,
“Saudi Arabia”, “Senegal”, “Serbia and Montenegro”, “Seychelles”, “Sierra Leone”, “Singapore”, “Slovakia”, “Slovenia”, “Solomon Islands”,
“Somalia”, “South Africa”, “Spain”, “Sri Lanka”, “Sudan”, “Suriname”, “Swaziland”, “Sweden”, “Switzerland”, “Syria”, “Taiwan”, “Tajikistan”,
“Tanzania”, “Thailand”, “Togo”, “Tonga”, “Trinidad and Tobago”, “Tunisia”, “Turkey”, “Turkmenistan”, “Tuvalu”, “Uganda”, “Ukraine”,
“United Arab Emirates”, “United Kingdom”, “United States of America”, “Uruguay”, “Uzbekistan”, “Vanuatu”, “Vatican City”, “Venezuela”,
“Vietnam”, “Yemen”, “Zambia”, “Zimbabwe”);
$options = ”;
foreach ($countries as $country) {
$selected = (strtolower($country) == strtolower($select)) ? “selected=’selected'” : “”;
$options .= “<option $selected value='” . $country . “‘ > $country </option>”;
will it be possible to provide a standard selected country. ?
thank you
July 11, 2014 at 1:39 pm #64247wzpModeratorChange:
array(“”, “Afghanistan”, To:
array(“Standard Default Country”, “Afghanistan”, July 11, 2014 at 2:10 pm #64248jurgenvtMemberthank you wzp. works! this is great!
July 11, 2014 at 2:11 pm #64249wzpModeratorYou can also reorder the country list, if you want; in order of political preference.
September 28, 2015 at 4:27 pm #64250wploveSpectatorI need to add “Bermuda” to the country list. I’ll modify the code above if needed. Can I put that in my child theme to protect it from updates? If so, what would be the appropriate file structure?
Would that edited country list also display for the backend new member creation?
September 29, 2015 at 12:53 am #64251adminKeymasterIf “Bermuda” is a country then we will add it to country list in our plugin. As far as I know, Bermuda is not officially a country. Is my understanding wrong?
October 31, 2015 at 9:41 am #64252wploveSpectatorGood point. It’s not officially a country. That being established, if I modify the code to include it anyway, is there a way to protect that change from future updates?
October 31, 2015 at 5:36 pm #64253wzpModeratorNo. Once you modify any of the files, it becomes your responsibility to keep a backup of your modifications, and to reinstate them after each software update. Normally, once your site enters “production mode” and is running properly, there should be little reason for you to update the software that frequently.
November 7, 2018 at 4:19 pm #64254amuck1MemberI have a different but related question:
I don’t need the country code for this particular website – all our members will be from the US state of North Carolina, but what I need is to change the Country code to County, and from there list our 100 counties. Can I accomplish this in the same way you described here?
Thanks,
~ Audrey
November 7, 2018 at 11:49 pm #64255adminKeymasterHi Audrey, What you suggested is doable. After you change the list in the code, you probably want to use the following technique to change the label of “Country” to “County” for the front-end:
November 8, 2018 at 7:37 pm #64256amuck1MemberHi there, I’ve changed the list and the front end labels – basically found every instance of ‘country’ or ‘countries’ and changed them to ‘county’ and ‘counties’ in the however the dropdown box is not working now. The placeholder box is there, but no dropdown activity. Suggestions? And thanks in advance!
~ Audrey
-
AuthorPosts
- You must be logged in to reply to this topic.