Last active
May 10, 2021 08:57
-
-
Save dparker1005/d4cc8b1b64c445deb5b63e18406fb04c to your computer and use it in GitHub Desktop.
Remove the text "Your %s membership is now active" from confirmation message if order does not have "success" status.
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 | |
// Copy from below here... | |
/* | |
* Remove the text "Your %s membership is now active" from confirmation message | |
* if order does not have "success" status. | |
* | |
* 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_confirmation_message_not_success( $message, $invoice ) { | |
if ( empty( $invoice ) ) { | |
return $message; | |
} | |
if ( $invoice->status !== 'success' ) { | |
global $current_user; | |
$message = str_replace( ' Your ' . $current_user->membership_level->name . ' membership is now active.', '', $message ); | |
} | |
return $message; | |
} | |
add_filter( 'pmpro_confirmation_message', 'my_pmpro_confirmation_message_not_success', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment