Skip to content

Instantly share code, notes, and snippets.

@codelion7
Created May 8, 2017 23:56
Show Gist options
  • Save codelion7/ac2f3a8cc85f307f25bdfbc0d13d8d40 to your computer and use it in GitHub Desktop.
Save codelion7/ac2f3a8cc85f307f25bdfbc0d13d8d40 to your computer and use it in GitHub Desktop.
Add Custom Driver Status Column to Affiliates Export CSV
<?php
/**
* Add Driver Status column to the exported affiliates CSV file
*
* @since 1.0
*/
function affwp_mobbyd_export_affiliates_csv_cols( $cols ) {
$cols['driver_status'] = 'Driver Status';
return $cols;
}
add_filter( 'affwp_export_csv_cols_affiliates', 'affwp_mobbyd_export_affiliates_csv_cols' );
/**
* Add the affiliate's Driver Status to our new csv column
*
* @since 1.0
*/
function affwp_mobbyd_export_get_data_affiliates( $data ) {
foreach ( $data as $key => $d ) {
$driver_status = 'lyft'; // Static Value for testing
//$driver_status = affwp_mobbyd_get_driver_status( $d['affiliate_id'] );
//$driver_status = !empty( $driver_status ) ? $driver_status : '';
$data[$key]['driver_status'] = $driver_status;
}
return $data;
}
add_filter( 'affwp_export_get_data_affiliates', 'affwp_mobbyd_export_get_data_affiliates' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment