How to make a country drop down list in profile field
You either would have to enter the list manually via the xprofile admin, or perhaps if you know SQL, import a script into the database that’ll add them for you
In early BP versions, there used to be a few handy pre-populated profile fields – including a country list (I think).
Would be nice to have them back. As @djpaul suggests, some SQL and a bit of plugin coding should do the trick…. Paul: is there a nice schematic of the xprofile tables available?
Seems there may have been a country list in version 1.0 : http://svn.buddypress.org/branches/1.0/bp-xprofile/prebuilt-fields/
I find something here: http://wordpress.org/extend/plugins/countries/
so is there a plugin to add these fields – country, state, etc to the registration and profiles…
has anyone found a plugin for registration, country, state/providence, city
anyone else having a problem with the new buddypress update, public profile links are showing up as html code
@nitestop please start a new topic for the html code showing up in your pages and give steps so we can replicate the issue.
I used PHP MyAdmin to export the table containing the field data – modified it to include the list of countries in excel and then imported it back into the original table checking the option to replace the existing data.
1. Create a dummy form field to get the format
Create a profile filed called Country as a dropdown select box.
Add a few options to the list e.g. Enter Your Country (this will be the default), Afghanistan, Aland Islands
Save and close the profile form editor
2. Export the field data to Excel
Login to PHPMyAdmin (you may need to login to CPanel first if you have a hosted website)
Go to the database and table containing the form data
Export the table to Excel CSV format. Check to include the field labels in the header.
3. Modify the data in Excel.
Opening the data in Excel will give you a feel for the layout of the data.
Not the ID number for the options you have entered above.
Copy and paste you list of countries (search on google for a list in excel or CSV format). Then make the data conform EXACTLY to the sample data you entered – making sure that the record ID numbers start from same ID number as your sample (you can delete the sample countries to avoid duplicates). Also ensure the Parent ID is the same as a field record.
Save the data as a CSV file
4. Import into the table
Go back to the table you exported in PHPMyAdmin
Import the CSV file you just modified. Check to replace the table contents. Ignore the first line of data if you have kept the field labels at the top of your file. Check that the record delimiter is a comma.
Now click GO and your data will be imported – Click Browse to check it.
5. Check your profile form
Go back to the profile form editor – your new country field should now be populated by the countries you imported.
This also works for any other dropdown list.
I just tried your method and it worked like a dream. You are pretty much my favorite person in the world right now. I have been trying to crack this with plugins and the like for about a month and I randomly revisited this topic not 12 hours after you explain how to do it. Bravo and thank you
Thanks for the tip. I was looking for a way to do it and found your tip. It worked like a charm.
Pewit, I am a rookie but am trying your instructions. The only question I have is: When you say, “make the data conform EXACTLY to the sample data you entered – making sure that the record ID numbers start from same ID number as your sample (you can delete the sample countries to avoid duplicates). Also ensure the Parent ID is the same as a field record”, what does that mean? I have a country list already in Excel, but it is just text. Is there a way to add the record id number and parent ID? Or do I even need to do this? Thanks for your help.
@pewit you are a gentleman & a scholar. that was brilliant. excellent instructions, many thanks!
You must be logged in to reply to this topic.