Thank you for your reply and answers. I do however have a related question.
At registration time, using a CRED user form, we capture a user spoken languages using Checkboxes custom field. We then pass the selected values to the related CPT record that we create on the fly using the "cred_save_data" hook. In the CPT record, we have a similarly defined Checkboxes custom field to store the languages. The challenge we are facing is that, we are passing the values of the "user language meta field" to the "CPT language meta field" exactly "as is" using the following:
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
if ($form_data['id']==xxx)
{
$user = get_user_by( 'id', $post_id );
$userlogin = $user->user_login;
$useremail = $user->user_email;
$languagestaught = get_user_meta($post_id, 'wpcf-languages-taught', true);
$new_post = array(
'post_type' => 'profile-archive',
'post_status' => 'publish',
'post_title' => $userlogin,
'post_author' => $post_id,
'meta_input' => array(
'wpcf-user-languages-taught' => $languagestaught,
),
);
wp_insert_post($new_post);
}
}
Because of the way Types store checkboxes in a serializes array, when passing the values selected from one checkboxes field to another checkboxes field, it does not work event if the field definition values are the same. See:
This the value that we store in the "user meta language checkboxes field":
a:2:{s:64:"wpcf-fields-checkboxes-option-88f76ae1b2b521ccc00621105a81acac-1";a:1:{i:0;s:6:"Arabic";}s:64:"wpcf-fields-checkboxes-option-7c065902a604d2aa9fc72a0914116677-1";a:1:{i:0;s:4:"Dari";}}
This the value that is expected to be stored in the "CPT meta language checkboxes field" for it to work:
a:2:{s:64:"wpcf-fields-checkboxes-option-c954607b4f3c4a21a3bb8f53e425673d-1";a:1:{i:0;s:6:"Arabic";}s:64:"wpcf-fields-checkboxes-option-4b696a1d773874edd1117e2e87e775b9-1";a:1:{i:0;s:4:"Dari";}}
When we straight copy the value of the "user meta language checkboxes field" into the "CPT meta language checkboxes field", it does not work since the wpcf-fields-checkboxes-option- are different.
Is there a way to read the array values from the "user meta language checkboxes field" and write those same values to the "CPT meta language checkboxes field" when a CRED user form is submitted.
Thank you.