Support » Plugin: Ultimate Member – User Profile, User Registration, Login & Membership Plugin » How to add a space after the comma when returning multi-select values

  • Resolved Chris

    (@lamordnt)


    Hi
    When using the multiselect field to return more than one value it is not adding a space after the comma. For example if I choose “red” and “blue” value it returns it as: red,blue without adding a space between the comma and blue.

    I am experiencing this on the members-list template. Is there a function that would allow me to style the way those values are returned? Maybe even an option to return them as an unordered list?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @lamordnt

    It has space after comma when I tested this on our end with the latest version.
    https://drive.google.com/file/d/1og8j6q7pLCfcO4Ty0svnqMFo2XqkVbU8/view?usp=sharing

    Could you please confirm what version of UM you’re using?

    Regards,

    Thread Starter Chris

    (@lamordnt)

    I am using version 2.1.16. Here is a screen shot of how it is returning the values:
    https://snipboard.io/VsXRy6.jpg

    I am not sure what your screenshot is supposed to be it just looks like a screen grab of an email.

    I am using this snippet in the theme to get the fields: user.um_committees

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @lamordnt

    Have you made any customization? The format is correct on our end. Here’s a screenshot:
    https://drive.google.com/file/d/1YGxIXn0WrYEBJwwVZXZ-ARlUI-VYYSA6/view?usp=sharing

    Try adding this code snippet to fix the format:

    add_filter("um_ajax_get_members_response","um_032221_ajax_get_members_response", 10, 2 );
    function um_032221_ajax_get_members_response( $response, $member_directory_data ){
    
        $users = $response['users'];
        $arr_users = [ ];
        foreach( $users as $user ){
            $arr_committees = explode(",", $user["um_committees"]);
            $arr_committees = implode(", ", $arr_committees );
            $user["um_committees"] = 1;
    
            $arr_users[ ] = $user;
        }
    
        $response['users'] = $arr_users;
    
        $response['member_directory'] = $member_directory_data;
        
        return $response;
    }

    Regards,

    • This reply was modified 4 months, 1 week ago by Champ Camba.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @lamordnt

    ..Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

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