Skip Navigation

[Résolu] Copy checkboxes field value from on post type to another

This support ticket is created Il y a 5 années et 1 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 réponses, has 2 voix.

Last updated by Valeriia Il y a 5 années et 1 mois.

Assisted by: Nigel.

Auteur
Publications
#1218041

Hi,

I have 2 post types: CUSTOMER and SHIFT.

CUSTOMER includes all sorts of fields, including multiple checkboxes provided by your plugin. SHIFT have the same set of fields.

On CUSTOMER submit, I need to copy the values of the checkboxes to the same fields of the SHIFT that I create at the same time (via cred_submit_complete).

How do I do that? I managed to copy the values of all the fields but not multiple checkboxes.

Examples of what I'm doing:

// takes the value from CUSTOMER
$transport = (isset($_POST['wpcf-transport'])) ? $_POST['wpcf-transport'] : ''; 

// records it in SHIFT
update_post_meta($shift_id, 'wpcf-transport', $transport); 

I see that in database it produces different records for the same fields.

For the CUSTOMER it looks like:

a:1:{s:64:"wpcf-fields-checkboxes-option-3a931c15a1edaf8db188cd47d6911f0c-1";a:1:{i:0;s:6:"public";}}

For the SHIFT it's slightly different:

a:1:{i:0;s:64:"wpcf-fields-checkboxes-option-3a931c15a1edaf8db188cd47d6911f0c-1";}

How do I make them match?

Thank you in advance.

#1218278

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

Unfortunately we have an API for outputting field values, but not for saving them.

This comes up from time to time and I don't have a solution for you.

Internally we have a plan to revamp how checkboxes fields are managed because they are currently very awkward to handle.

I will consult with the developers to see if they can provide a solution, and I'll let you know what they come back with.

#1218786

Hi Nigel,

It is very awkward indeed, thank you for saying that.

I have built my own checkboxes, so the question is resolved for now.

Thanks.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.