• Resolved moacirsantana

    (@moacirsantana)


    Hello, it’s a very good plugin

    I use CMB2 to create new user custom fields and some of them are multiple selects.

    Fields like this: https://i.imgur.com/53OtYuN.gif

    Array? I’ve tried separated by commas but it didn’t work

    How to proceed to import the user with the given values?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Javier Carazo

    (@carazo)

    @moacirsantana,

    Good morning, could you show me how are those values stored in database?

    Thread Starter moacirsantana

    (@moacirsantana)

    I took an user as an example:

    Two of the four values are stored like this:

    a:2:{i:0;s:8:”F.P.T.P.”;i:1;s:8:”C.B.T.E.”;}

    Plugin Author Javier Carazo

    (@carazo)

    @moacirsantana,

    As this is described in the documentation you can import lists like this using :: to separate values.

    In this case you should have:

    F.P.T.P.::C.B.T.E.

    Any problem, tell us.

    Thread Starter moacirsantana

    (@moacirsantana)

    it didn’t work, I thought it was because of the dots in the string (F.P.T.P), then I changed their values to int numbers and I faced the following error:

    Fatal error: Uncaught TypeError: Argument 2 passed to PW_CMB2_Field_Select2::sort_array_by_array() must be of the type array, string given, called in C:\xampp\htdocs\villela\wp-content\plugins\cmb-field-select2-master\cmb-field-select2.php on line 88 and defined in C:\xampp\htdocs\villela\wp-content\plugins\cmb-field-select2-master\cmb-field-select2.php:120 Stack trace: #0 C:\xampp\htdocs\villela\wp-content\plugins\cmb-field-select2-master\cmb-field-select2.php(88): PW_CMB2_Field_Select2->sort_array_by_array(Array, '1') #1 C:\xampp\htdocs\villela\wp-content\plugins\cmb-field-select2-master\cmb-field-select2.php(69): PW_CMB2_Field_Select2->get_pw_multiselect_options('1', Object(CMB2_Types)) #2 C:\xampp\htdocs\villela\wp-includes\class-wp-hook.php(288): PW_CMB2_Field_Select2->render_pw_multiselect(Object(CMB2_Field), '1', '9', 'user', Object(CMB2_Types)) #3 C:\xampp\htdocs\villela\wp-includes\class-wp-hook.php(312): WP_Hook->apply_filters('', Array) #4 C:\xampp\htdocs\villela\wp-includes\plugin.php(478): WP_Hook->do_action( in C:\xampp\htdocs\villela\wp-content\plugins\cmb-field-select2-master\cmb-field-select2.php on line 120

    Only using :: as separators doesn’t seem to be working properly.

    However, as you can see in this image: https://i.imgur.com/qDJIFNh.gif, the values are being stored correctly but there’s something missing preventing it to proceed with the other fields.

    • This reply was modified 4 years, 8 months ago by moacirsantana.
    Plugin Author Javier Carazo

    (@carazo)

    This is error is from CMB2. Have you asked them?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Multiple values’ is closed to new replies.