BuddyDev

Search

[Resolved] How to create a profile field of all countries in the world

  • Participant
    Level: Enlightened
    Posts: 31
    Dale Reardon on #18786

    Hi,
    I wish to create a profile field that is a dropdown combo box selection of all the countries in the world in order to not use a freeform text field where everyone will type/spell things differently and then the field won’t be searchable.

    Is there some code or plugin that has all the countries already created?

    And even better if there was the ability to then have the person select their State/County and suburb from conditional selections depending on the country they chose in the previous field.

    Obviously have BuddyDev membership but if have to buy another plugin that is fine.

    Thanks,
    Dale.

  • Keymaster
    (BuddyDev Team)
    Posts: 24715
    Brajesh Singh on #18787

    Hi Dale,
    Thank you for posting.

    1. There are existing solution for adding countries list. The most popular seems to be adding all countries as Multi selection fields and child options. The problem with this approach is it won’t work for multi lingual websites.

    2. For a client in past, I did create countries field using code. That allowed us to translate the names. The problem with that approach is the default search won’t be able to find the countries properly. BP profile Search can.

    Now coming back to states and provinces, I don’t think there exist any solution for this. The list can become quiet exhaustive. It is feasible to do it for a few countries.

    I will love to work on it in future and do it something similar to what WooCommerce does for the Country/States.

    For now, If you want to go with multiselect option, you may use the code from here.
    https://github.com/Mamaduka/cfcommunity/blob/master/wp-content/plugins/bp-custom.php#L91

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 31
    Dale Reardon on #18794

    Thanks very much.
    I will use the Github code you link to for the time being.

    Dale.

The topic ‘ [Resolved] How to create a profile field of all countries in the world’ is closed to new replies.

This topic is: resolved