Created
April 14, 2017 02:56
-
-
Save greathmaster/01c3aa1a8bc50f07816ebc3d39960c91 to your computer and use it in GitHub Desktop.
Add the group code column to the Order CSV export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Add the group code column to the Order CSV export | |
//Set up the column header and callback function | |
function my_pmpro_orders_csv_extra_columns($columns) | |
{ | |
$columns["group_code"] = "my_extra_order_column_notes"; | |
return $columns; | |
} | |
//The actual call back for the column | |
function my_extra_order_column_notes($order) | |
{ | |
global $wpdb; | |
$group_code = pmpro_getMatches("/{GROUPCODE:([^}]*)}/", $order->notes, true); | |
if(!empty($group_code)) | |
return $group_code; | |
else | |
return ""; | |
} | |
add_filter("pmpro_orders_csv_extra_columns", "my_pmpro_orders_csv_extra_columns"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment