• Resolved Johan WALTER

    (@johan_walter)


    Hi Andrea

    I have questions about the way field dispay in search form

    1 – I haven’t found a way to apply Select2 for select box in search form.
    Even if the Select2 is enabled at field level, search form use plain select box
    Example
    I have a field “Jobs” with 92 values, I enabled Select2
    Screenshot https://prnt.sc/ugdfcd
    On profile, we have Select2 select box with search / filter
    Screenshot
    https://prnt.sc/ugdfiu
    https://prnt.sc/ugdfmm

    On search form, multiple select box does not display as Select2
    Screenshot https://prnt.sc/ugdf3u

    Is there any chance you can consider to have Select2 on search form etiher enabling it on search form settings or just apply what is defined at field level ?

    2 – If I have a field with option button, it displays as select box in search form. There is no way to apply option button in search form or Select2 select box

    Thanks

    Regards

    Johan

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Johan,

    To add Select2 support to your search forms, open the file bps-form-default.php, locate the initial lines:

    $F = bps_escaped_form_data ($version = '4.9');
    wp_register_script ('bps-template', plugins_url ('bp-profile-search/bps-template.js'), array (), BPS_VERSION);
    ?>

    and replace them with:

    $F = bps_escaped_form_data ($version = '4.9');
    wp_register_script ('bps-template', plugins_url ('bp-profile-search/bps-template.js'), array (), BPS_VERSION);
    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(document).ready(function($) {
    		$('.bps-form select').select2();
    	});
    </script>

    Save the file, then copy it to the ‘buddypress/members’ directory in your theme’s root, otherwise it will be overwritten during the next BP Profile Search update.

    Thread Starter Johan WALTER

    (@johan_walter)

    Hi Andrea

    I replaced lines in bps-form-default.php
    I don’t have in theme a directory buddypress/members
    I use Gwangi
    Directory I have are
    /themes/gwangi/buddypress-global-search
    /themes/gwangi/inc/bp-profile-search
    /themes/gwangi/inc/bp-profile-search/customizer

    I have tried to place the file in those files, it does not work, form does not have Select2
    I have tried to replace the file directly in plugin BP Search Form, it does not work neither

    If you have an idea

    Thanks

    Regards

    Johan

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Johan,

    Gwangi provide their own BP Profile Search templates, so I suggest you ask the Gwangi team for advice if you wish to modify those templates.

    If you want to try yourself, the template location is shown in the Users -> Profile Search admin page, under the Template column. You can modify that template as suggested in the above post.

    Thread Starter Johan WALTER

    (@johan_walter)

    Hi Andrea

    Ok
    Thanks

    Regards

    Johan

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Select2 in search form’ is closed to new replies.