Forked from kimwhite/my_pmp_add_gateway_column_to_member_export_cvs.php
Last active
May 9, 2023 14:51
-
-
Save dwanjuki/a00bac91e25ac95a09b07e49293d2ade to your computer and use it in GitHub Desktop.
Add a Last Payment Status column to your members Export CSV
This file contains 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 | |
/** | |
* This recipe will add a Last Payment Status column to your members Export CSV | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_members_list_csv_payment_status_column($columns) { | |
$columns["Payment Status"] = "my_payment_status_column"; | |
return $columns; | |
} | |
add_filter("pmpro_members_list_csv_extra_columns", "my_pmpro_members_list_csv_payment_status_column", 10, 2); | |
function my_payment_status_column($user) { | |
$last_order = new MemberOrder(); | |
$last_order->getLastMemberOrder($user->ID); | |
$payment_status = ''; | |
if(!empty($last_order->status)) { | |
$payment_status = $last_order->status; | |
} | |
return $payment_status; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment