Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save greathmaster/01c3aa1a8bc50f07816ebc3d39960c91 to your computer and use it in GitHub Desktop.
Save greathmaster/01c3aa1a8bc50f07816ebc3d39960c91 to your computer and use it in GitHub Desktop.
Add the group code column to the Order CSV export
<?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