Skip to content

Instantly share code, notes, and snippets.

@Pebblo

Pebblo/example.php

Last active Feb 22, 2018
Embed
What would you like to do?
Example of how to use the date formats set within your sites general settings in the CSV report columns.
<?php //Please do not add the PHP tag if you already have one.
function tw_reg_date_format( $reg_csv_array, $reg_row ) {
//Set the columns you can't to convert the date on here.
$date_columns = array(
'Ticketdatum',
'Time registration occurred[REG_date]'
);
//Loop through the columns set and use localized date formats.
foreach($date_columns as $column) {
//Hardcode the date format?
//$date_format = 'D., d.m.y';
//Use the formats set in general settings.
$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );
$reg_csv_array[$column] = date_i18n( $date_format . ' ' . $time_format, strtotime( $reg_csv_array[$column] ) );
}
return $reg_csv_array;
}
add_filter('FHEE__EE_Export__report_registrations__reg_csv_array', 'tw_reg_date_format', 10, 2 );
@Pebblo

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.