02/06/2019 at 1:19 pm
#483813
Participant
If I were to be offended by light hearted tongue in cheek (which I easily recognize) I would be in great trouble! Anything short of outright F-bombs is fine! :)
Ok, that seems to be working, the custom meta does it. I am guessing that I need to do a snippet like I did for my other textbox to be able to import the value from a csv file but I don’t have to register it?
Do I just use these two routines?
// Register the custom fields CSV Import mapping options and processing callback.
add_filter( 'cncsv_map_import_fields', 'cncsv_header_name' );
add_action( 'cncsv_import_fields', 'cncsv_process_import', 10, 3 );
function cncsv_header_name( $fields ) {
// The field_id should match exactly the field id used when registering the custom field.
$fields['schl_field_id_1'] = 'Grades';
return $fields;
}
function cncsv_process_import( $id, $row, $entry ) {
// The field_id should match exactly the field id used when registering the
custom field.
$data = $entry->arrayPull( $row, 'schl_field_id_1', '' );
$data = cnFormatting::maybeJSONdecode( stripslashes( $data ) );
cnEntry_Action::meta(
'update',
$id,
array(
array(
'key' => 'schl_field_id_1', //
'value' => $data
),
)
);
}
Where do I send the Starbucks card?
