Skip Navigation

[Resuelto] Copy checkboxes field value from on post type to another

This support ticket is created hace 5 años, 8 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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+00:00)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por Valeriia hace 5 años, 8 meses.

Asistido por: Nigel.

Autor
Mensajes
#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

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00: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.