• I’m trying to add a filter to a member directory but it’s not displaying. I believe it’s a select2.js conflict but I can’t get it to show up. It always populates as hidden. I have users with data set on this field and all properties are set correctly. How can I get a dropdown to display within a member directory filter?

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @jessepschultz

    Can you please share a screenshot of your filter settings area?

    missveronica

    (@missveronicatv)

    Thread Starter jessepschultz

    (@jessepschultz)

    I tried the select2 conflicts script, but no luck. I’ve also got a dropdown to appear on the edit profile page by this script, but it still doesn’t show on filtering. Screen shot link is here

    add_filter( 'um_extend_field_classes', 'um_121520_extend_field_classes', 999999, 3);
    function um_121520_extend_field_classes( $classes, $key, $data ){
    
        if( $key == 'primarymedium' ){
            $classes = str_replace("um-s1", "", $classes);
        } 
        return $classes;
    }
    missveronica

    (@missveronicatv)

    @jessepschultz

    Did you use only this code snippet and not the bigger one:

    add_filter( 'um_dequeue_select2_scripts', '__return_true' );

    Thread Starter jessepschultz

    (@jessepschultz)

    Yes I used both snippets of code.

    missveronica

    (@missveronicatv)

    @jessepschultz

    Look at the HTML Source file if you have an id for the other select2 js file.
    The UM id is select2-js

    Thread Starter jessepschultz

    (@jessepschultz)

    Sorry I replied to another topic. I have updated my script to only use this snippet, still not showing up.

    add_filter( 'um_dequeue_select2_scripts', '__return_true' );

    missveronica

    (@missveronicatv)

    @jessepschultz

    Look at the HTML source file if you can find the select2 js files.
    You will find these lines by the end of the HTML source.

    The UM js file has an id select2-js and what is the id of the conflicting js file?

    • This reply was modified 1 month, 1 week ago by missveronica.
    • This reply was modified 1 month, 1 week ago by missveronica.
    Thread Starter jessepschultz

    (@jessepschultz)

    If I check my html source there’s no other select2 js file loading. Only css files. You can check the source in my link above and see for yourself. The other css is coming from revslider plugin but no js file loading other than from UM.

    missveronica

    (@missveronicatv)

    @jessepschultz

    The other thread with a user with similar select2 issue and this code snippet solved the issue. The Theme added the select2 js file. A Theme from same company as your Theme.

    You can try the code snippet instead of the first script.

    add_filter( 'um_dequeue_select2_scripts', 'um_dequeue_select2_scripts_fix', 10, 1 );
    
    function um_dequeue_select2_scripts_fix( $bool ) {
    
        wp_dequeue_style( 'select2' );
        wp_deregister_style( 'select2' );
    
        wp_dequeue_script( 'select2.min.js');
        wp_deregister_script('select2.min.js');
    
        wp_dequeue_style( 'select2-css' );
        wp_deregister_style( 'select2-css' );
    
        wp_dequeue_script( 'select2.min.js-js');
        wp_deregister_script('select2.min.js-js');
    
        return $bool;
    }
    Thread Starter jessepschultz

    (@jessepschultz)

    Hello, still no luck when adding this latest script to my functions file. Appreciate the help…any other ideas?

    missveronica

    (@missveronicatv)

    @jessepschultz

    Yes one more attempt, you can try this code snippet which will deactivate
    the UM select2 JavaScript and style sheet:

    add_action( 'wp_print_styles', 'um_dequeue_my_select2_style' );
    add_action( 'wp_print_scripts', 'um_dequeue_my_select2_script' );
    
    function um_dequeue_my_select2_style() {
        wp_dequeue_style( 'select2' );
        wp_deregister_style( 'select2' );
    }
    
    function um_dequeue_my_select2_script() {
        wp_dequeue_script( 'select2' );
        wp_deregister_script( 'select2' );
    }
    missveronica

    (@missveronicatv)

    @jessepschultz

    Sorry, use this code snippet instead which is the recommended solution by WP to dequeue scripts and styles.

    add_action( 'wp_enqueue_scripts', 'um_dequeue_my_select2_scripts', 999 );
    
    function um_dequeue_my_select2_scripts() {
    
        wp_dequeue_script( 'select2' );
        wp_deregister_script( 'select2' );
    
        wp_dequeue_style( 'select2' );
        wp_deregister_style( 'select2' );
    }
    Thread Starter jessepschultz

    (@jessepschultz)

    Still no luck. This latest update causes the member grid not to load at all…and the dropdown is still hidden.

    missveronica

    (@missveronicatv)

    @jessepschultz

    In your case there is not a conflict with another loaded select2 script.

    Have you done a Plugin/Theme conflict test described in this guide:

    https://docs.ultimatemember.com/article/96-how-to-do-a-plugin-theme-conflict-test

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.