Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipokkel/e2384e9b2815dbb6bcd194b3e9dbb8fb to your computer and use it in GitHub Desktop.
Save ipokkel/e2384e9b2815dbb6bcd194b3e9dbb8fb to your computer and use it in GitHub Desktop.
<?php
/**
* Add a gateway column to the member edit orders page.
*
* 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 gateway_pmpromh_orders_extra_cols_header() {
echo '<th>' . esc_html__( 'Gateway', 'paid-memberships-pro' ) . '</th>';
}
add_action( 'pmpromh_orders_extra_cols_header', 'gateway_pmpromh_orders_extra_cols_header' );
function gateway_pmpromh_orders_extra_cols_body( $order ) {
$gateway = $order->gateway;
// get gateway, if gateway environment is sandbox append (test) to the gateway name.
if ( 'free' !== $gateway && $order->gateway_environment === 'sandbox' ) {
$gateway = $order->gateway . ' (test)';
}
echo '<td> ' . esc_html( $gateway ) . ' </td>';
}
add_action( 'pmpromh_orders_extra_cols_body', 'gateway_pmpromh_orders_extra_cols_body' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment