BuddyDev

Search

BuddyPress Xprofile Custom Field Types Country – add Country to list

  • Participant
    Level: Initiated
    Posts: 2
    Chris on #44293

    Hello,
    WE are using the BuddyPress Xprofile Custom Field Types Plugin.
    I need to add a country to the countrylist in a way that is updatesave.
    I could add it simply in the pluginfile, but the next update would erase my change.
    How can i add a Country, we need Kosovo added to the List.

    Thx for your Help!

    Best Regards

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2499
    Ravi on #44295

    Hello Chris,

    Thank you for using the plugin. I have updated the country list in the plugin. We will update you within 24 hrs regarding the release.

    Please check the commit URL and let me know if I added the correct country code:
    https://github.com/buddydev/bp-xprofile-custom-field-types/commit/6ed56b3b1b9c209c1d2187e5ed89204ae1226f2b

    Regards
    Ravi

  • Keymaster
    (BuddyDev Team)
    Posts: 22212
    Brajesh Singh on #44296

    Hi Chris,
    We are sorry, we had to revert the last change after a discussion here. A wikipedia entry shows it as partially recognized and we do not want the country list to affect the existing sites using this plugin.

    we will be adding a filter and providing you the code to locally manage addition/removal of countries from the list.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 2
    Chris on #44306

    Hi Brajesh,

    Thx for the reply and the solution.
    I’m looking forward to your filter.

    Regards
    Chris

  • Keymaster
    (BuddyDev Team)
    Posts: 22212
    Brajesh Singh on #44472

    Hi Chris,
    Hope you are doing well.
    I am sorry, I posted in wrong topic about the solution.

    Please upgrade to 1.2.2 and add the following code

    
    // add extra country to the country field dropdown.
    add_filter( 'bpxcftr_countries_list', function ( $countries ) {
    
    	$countries['XK'] = __( 'Kosovo', 'bp-xprofile-custom-field-types' );
    	// sort alphabetically by keys.
    	ksort( $countries );
    
    	return $countries;
    } );
    

    That will add the country.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 2
    Chris on #44652

    Hi Brajesh,

    Thx the integration works fine and the Country is in the list.

    How can i sort by countryname?
    Sort by key leaves the list completely mixed.

    Thx for the help.

    Regards, Chris

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2499
    Ravi on #44662

    Hello Chris,

    Thank you for your acknowledgement. Please replace ‘ksort’ with ‘asort’ function. It will sort countries by name.

    Regards
    Ravi

You must be logged in to reply to this topic.

This topic is: not resolved