Forked from ipokkel/my-pmpro-confirmation-message.php
Created
August 21, 2023 13:27
-
-
Save JarrydLong/c5a23aa492f25dc866c73878913d541a to your computer and use it in GitHub Desktop.
Create a custom confirmation with a custom message
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 changes the default confirmation message when a user checks out. | |
* | |
* | |
* 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/ | |
*/ | |
remove_filter( 'pmpro_confirmation_message', 'pmpro_pmpro_confirmation_message' ); | |
// add new confirmation text | |
function my_pmpro_confirmation_message( $message ) { | |
global $current_user; | |
$message = ''; | |
// Set default | |
$message .= '<p>Thank you for choosing the <strong>' . pmpro_getMembershipLevelForUser( $current_user->ID )->name . '</strong> membership.</p>'; | |
return $message; | |
} | |
add_filter( 'pmpro_confirmation_message', 'my_pmpro_confirmation_message', 20, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment