Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php //do not copy
/**
* This recipe will remove the confirmation messages from Sponsored Members on checkout and email
* when a member pays by check. Only once payment has been received will the codes show.
*
* 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 mypmpro_sm_remove_confirmation_messages(){
$morder = new MemberOrder();
$morder->getLastMemberOrder( null, '' );
if( $morder->status == 'pending' && $morder->gateway == 'check' ) {
remove_filter( 'pmpro_confirmation_message', 'pmprosm_pmpro_confirmation_message' );
remove_filter( "pmpro_email_body", "pmprosm_pmpro_email_body", 10, 2 );
}
}
add_action( 'init', 'mypmpro_sm_remove_confirmation_messages' );
@dparker1005
Copy link

dparker1005 commented Sep 23, 2022

This did not seem to work on the init hook, but changing that to pmpro_after_checkout worked as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment