BuddyDev

Search

[Resolved] Xprofile Field – Country Select

Tagged: ,

  • Participant
    Level: Initiated
    Posts: 19
    Quint A. Rahaman, Jr. on #45159

    I thought I would ask for feedback since the Youzify plugin developer recommended your plugin bp-xprofile-custom-field-types. 😉

    Use Case:
    1. Use the Youzify advanced member search plugin to search the Members Directory

    Issue:
    Item 1. Filter using the Country field. However, the user cannot select multiple countries since this is a dropdown list.

    Is this possible?

  • Participant
    Level: Initiated
    Posts: 19
    Quint A. Rahaman, Jr. on #45160

    Or would this be simpler using the BP Profile Search plugin which you referenced in the BuddyPress Xprofile Custom Field Types description? You probably have experience with both search plugin implementations.

  • Participant
    Level: Initiated
    Posts: 19
    Quint A. Rahaman, Jr. on #45165

    This is what I’ve done thus far:

    1. Installed BP Profile Search plugin
    2. Added the following snippet in WPCodeBox (active everywhere):

    
    <?php 
    
    add_action ('bps_before_search_form', 'bps_enable_select2');
    add_action ('bp_ps_before_search_form', 'bps_enable_select2');
    function bps_enable_select2 ($F)
    {
    	wp_enqueue_script ('select2-js', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js', array ('jquery'));
    	wp_enqueue_style ('select2-css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css');
    ?>
    	<script>
    		jQuery(function ($) {
    		//	$('.bps-selectbox select').select2({width: '10em', dropdownAutoWidth: true});
    			$('.bps-multiselectbox select').select2({width: '10em', dropdownAutoWidth: true});
    		});
    	</script>
    	
    <?php
    }
    

    3. Added a “search” form via the BP Profile Search plugin
    4. On that form, attempted to add my Country Select field (created in Profiles) but could not find it in the list. In the BuddyPress Xprofile Custom Field Types description, it specified that all the field types were compatible. Maybe not this one?
    5. If it were available on the list, then could it be used with Select2?

    Objective is to search for members in the Members Directory from multiple countries, at the very least.

  • Keymaster
    (BuddyDev Team)
    Posts: 24566
    Brajesh Singh on #45169

    Hi Quint,
    Thank you for the questions.

    1. We do not provide compatibility with Youzify. We lack the ability to assist you with that one.

    2. We will provide support for BP profile Search plugin. At the moment, the Country field is not registered as searchable by us. We will update the xprofile to register it as searchable. Please allow me to get back to you by Monday/Tuesday.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 19
    Quint A. Rahaman, Jr. on #45174

    Hello Brajesh,

    1. Sorry, I had meant to state in the earlier comment that I had deactivated the Youzify search plugin in favor of the one you support.

    2. Sounds great!

    Quint

  • Keymaster
    (BuddyDev Team)
    Posts: 24566
    Brajesh Singh on #45178

    Thank you Quint.

  • Keymaster
    (BuddyDev Team)
    Posts: 24566
    Brajesh Singh on #45250

    Hi Quint,
    Please upgrade to 1.2.3. The plugin supports the BP Profile Search for Country field.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 19
    Quint A. Rahaman, Jr. on #45264

    Hello Brajesh,

    Thank you very much!

    Initially, that worked for the most part. The BP Profile Search developer then made a change:

    * I changed 'set' to 'text' in "BuddyPress Xprofile Custom Field Types", file class-bp-profile-search-helper.php, line 77;

    Not that you need the following but she also wrote a snippet to convert that field’s list of checkboxes rendered in the search form to a multiselect dropdown:

    
    add_action ('bps_field_before_search_form', 'change_display');
    add_action ('bp_ps_field_before_search_form', 'change_display');
    function change_display ($f)
    {
    	if ($f->code == 'field_16' && $f->display == 'checkbox')	// field_16 is your Country field
    	{
    		$f->display = 'multiselectbox';
    	}
    }
    

    Thanks again,
    Quint

  • Keymaster
    (BuddyDev Team)
    Posts: 24566
    Brajesh Singh on #45309

    Hi Quint,
    Thank you.

    Probably you do not need to update that. The BP profile search plugin allows selecting mode when adding the field to search. Try switching the mode. They control the user Interface.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 19
    Quint A. Rahaman, Jr. on #45319

    Hello Brajesh,

    I don’t see where that capability lies. Andrea, in Italy, is the plugin developer and is the one who performed the troubleshooting which lead to the code and recommendation provided earlier.

    Where on here is it? I must be missing something or looking at the wrong spot.

    https://www.dropbox.com/s/iq3lf5tkkhbxhgw/Screen%20Shot%202022-06-12%20at%205.13.45%20AM.png?dl=0

    Cheers,
    Quint

The topic ‘ [Resolved] Xprofile Field – Country Select’ is closed to new replies.

This topic is: resolved