Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 8.5.17, action, cncsv_import_fields, cncsv_map_import_fields, CSV, extension, filter, import
- This topic has 1 reply, 2 voices, and was last updated 10 years, 2 months ago by
Steven Zahm.
-
AuthorPosts
-
06/13/2016 at 5:35 pm #379391
Toby Ebel
GuestTried using this tutorial:
http://connections-pro.com/2015/03/19/quicktip-csv-import-custom-meta-fields/
Not getting anything in my Map to dropdown.
Here’s the Code Snippet I input and activated:
add_filter( ‘cncsv_map_import_fields’, ‘cncsv_import_meta_fields_options’ );
function cncsv_import_meta_fields_options( $fields ) {$fields[‘Degrees’] = ‘Degrees’;
$fields[‘Expertise’] = ‘Expertise’;
$fields[‘Ext.’] = ‘Ext.’;
$fields[‘Office’] = ‘Office’;
$fields[‘vantage’] = ‘vantage’;return $fields;
}add_action( ‘cncsv_import_fields’, ‘cncsv_import_meta_fields_import’, 10, 2 );
function cncsv_import_meta_fields_import( $id, $row ) {$degrees = isset( $row->Degrees ) ? $row->Degrees : ”;
$expertise = isset( $row->Expertise ) ? $row->Expertise : ”;
$extension = isset( $row->ext ) ? $row->ext : ”;
$office = isset( $row->office ) ? $row->office : ”;
$vantage = isset( $row->vantage ) ? $row->vantage : ”;cnEntry_Action::meta(
‘update’,
$id,
array(
array(
‘key’ => ‘Degrees’,
‘value’ => $degrees
),
array(
‘key’ => ‘Expertise’,
‘value’ => $expertise
),
array(
‘key’ => ‘Ext’,
‘value’ => $extension
)
array(
‘key’ => ‘Office’,
‘value’ => $office
)
array(
‘key’ => ‘vantage’,
‘value’ => $vantage
)
)
);06/14/2016 at 9:53 am #379432Steven Zahm
Keymaster@ Toby
There were several minor errors in your code snippet such as inconsistent letter case and missing commas. I’ve corrected the error in the snippet below. I hope that helps!
add_filter( 'cncsv_map_import_fields', 'cncsv_ebel_import_meta_fields_options' ); function cncsv_ebel_import_meta_fields_options( $fields ) { $fields['degrees'] = 'Degrees'; $fields['expertise'] = 'Expertise'; $fields['ext'] = 'Ext.'; $fields['office'] = 'Office'; $fields['vantage'] = 'vantage'; return $fields; } add_action( 'cncsv_import_fields', 'cncsv_ebel_import_meta_fields_import', 10, 2 ); function cncsv_ebel_import_meta_fields_import( $id, $row ) { $degrees = isset( $row->degrees ) ? $row->degrees : ''; $expertise = isset( $row->expertise ) ? $row->expertise : ''; $extension = isset( $row->ext ) ? $row->ext : ''; $office = isset( $row->office ) ? $row->office : ''; $vantage = isset( $row->vantage ) ? $row->vantage : ''; cnEntry_Action::meta( 'update', $id, array( array( 'key' => 'Degrees', 'value' => $degrees ), array( 'key' => 'Expertise', 'value' => $expertise ), array( 'key' => 'Ext.', 'value' => $extension ), array( 'key' => 'Office', 'value' => $office ), array( 'key' => 'vantage', 'value' => $vantage ), ) ); } -
AuthorPosts
- You must be logged in to reply to this topic.
