Tell us what you are trying to do?
Trying to export through WP ALL IMPORT the data from User form generated in toolset. Would you help me to identify the php functions to get the data from this serialized data (obtained in Toolset Post Form): a:2:{s:64:"wpcf-fields-checkboxes-option-f7f9c7a19a5c90a0cbde74b0a6c57735-1";a:1:{i:0;s:11:"Mitigación";}s:64:"wpcf-fields-checkboxes-option-885b1ff227ab8644a29dbebe1d08ab27-1";a:1:{i:0;s:20:"Obras de terracería";}}
In my export, I want to see only "Mitigación" or "Obras de terracería"
Is there any documentation that you are following?
yes, this hidden link
Is there a similar example that we can see?
What is the link to your site?
Hi,
Thank you for contacting us and I'd be happy to assist.
To suggest the most efficient way to achieve this, I'll need to see how these checkboxes type custom field is set up in the admin area.
Can you please share a screenshot showing this field's settings in the custom field group?
regards,
Waqar
Thank you Waqar.
I upload an image with the admin area. The problem is with the checkboxes only.
You can create an account and register a company here: hidden link
Additionally I uploaded an image with the option of WP ALL IMPORT to export with php function, maybe here we can figure out a solution with a php code.
Thank you!
Thank you for waiting, as we had an unusually busy forum queue over the weekend.
I'm currently performing some tests on my website with a similar 'checkboxes' type field. Will share the findings, as soon as this testing completes.
Thank you for your patience.
Thank you for waiting.
On my test website, I was able to make this export work using the following custom PHP function:
function my_convert_checkbox_to_txt( $value ) {
// Return nothing if there is no value.
if ( empty( $value ) ) {
return null;
}
$target_values = array('one','two');
$return_values = array();
for ($i=0; $i < sizeof($target_values) ; $i++) {
if (strpos($value, $target_values[$i]) !== false) {
$return_values[] = $target_values[$i];
}
}
// Return comma-delimited list of values.
return implode( ', ', $return_values );
}
In my test, the checkboxes field had two checkbox options with values 'one' and 'two', respectively. But, on your website, you'll update the values in the array '$target_values', as per the values used by your checkboxes type field.
( screenshot: hidden link )
Thanks Waqar.
I'm having this error: Parse error: syntax error, unexpected ' ' (T_STRING) in your code on line 8
And the serialized persist. (please see the wpcf-obra-civiles field) in the preview.
UPDATE: I copied and pasted it in an editor and it pass... but still not getting the data (please see the wpfc-obras-civiles field.
Can you please share temporary admin login details, so that I can see the export section in the admin area?
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
Thank you for sharing the access details.
I just tested the export using the same function and the 'Obras civiles' field and it worked as expected.
Screenshot settings: hidden link
Screenshot preview: hidden link
You can see the settings used in the last export, in the 'Manage Exports' section.
My issue is resolved now. Thank you!