Skip to content

Instantly share code, notes, and snippets.

@JarrydLong
Created July 28, 2022 08:49
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 JarrydLong/97bccf1c0cdaf0d062eb7e75eeea65fa to your computer and use it in GitHub Desktop.
Save JarrydLong/97bccf1c0cdaf0d062eb7e75eeea65fa to your computer and use it in GitHub Desktop.
<?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

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