Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to make a country drop down list in profile field

  • @imjscn

    Participant

    When add profile field, there’s a choice of adding Drop Down Select Box. But that’s a lot of opions to input. Is there an easy way to add a country list into BP profile opion?

Viewing 16 replies - 1 through 16 (of 16 total)
  • @ladysham

    Participant

    I’d like to know this too. Anyone?? Thanks!

    @djpaul

    Keymaster

    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

    @rogercoathup

    Participant

    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?

    @aces

    Participant

    Seems there may have been a country list in version 1.0 : https://svn.buddypress.org/branches/1.0/bp-xprofile/prebuilt-fields/

    @imjscn

    Participant

    @nitestop

    Participant

    so is there a plugin to add these fields – country, state, etc to the registration and profiles…

    @djpaul

    Keymaster

    No, not seen any.

    @nitestop

    Participant

    has anyone found a plugin for registration, country, state/providence, city
    also
    anyone else having a problem with the new buddypress update, public profile links are showing up as html code

    @mercime

    Participant

    @nitestop please start a new topic for the html code showing up in your pages and give steps so we can replicate the issue.

    @nitestop

    Participant

    ok how do i start a new topic…

    @pewit

    Participant

    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.

    Method
    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
    (e.g. wrdp1>wp_bp_xprofile_fields)
    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.

    @msmithwisedu

    Participant

    @pewit
    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

    @cdkb

    Participant

    @pewit,

    Thanks for the tip. I was looking for a way to do it and found your tip. It worked like a charm.

    @txrunner

    Participant

    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.

    @somethingelse

    Participant

    @pewit you are a gentleman & a scholar. that was brilliant. excellent instructions, many thanks!

    @lebearuk

    Participant

    @pewit you’re a star for providing that method, cheers!

Viewing 16 replies - 1 through 16 (of 16 total)
  • The topic ‘How to make a country drop down list in profile field’ is closed to new replies.
Skip to toolbar