Skip to content

Commit

Permalink
Merge pull request #183 from andrewlimaza/allow-custom-confirmation-m…
Browse files Browse the repository at this point in the history
…essage

Added filter to show custom confirmation message.
  • Loading branch information
dparker1005 committed Jul 18, 2024
2 parents 87a6214 + 87b9eaf commit 1a8ac70
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pmpro-approvals.php
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ public static function pmpro_membershiplevels_template_level( $level, $template
*/
public static function pmpro_confirmation_message( $confirmation_message, $pmpro_invoice ) {

global $current_user;
global $current_user, $wpdb;

// Try to get the membership ID for the confirmation.
if ( ! empty( $pmpro_invoice ) ) {
Expand Down Expand Up @@ -1458,7 +1458,21 @@ public static function pmpro_confirmation_message( $confirmation_message, $pmpro
$confirmation_message .= '<div class="pmpro_payment_instructions">' . wpautop( wp_unslash( get_option("pmpro_instructions") ) ) . '</div>';
}

/**
* Filter to show the confirmation message for levels that require approval.
* @param bool $show Whether to show the confirmation message or not.
* @param int $membership_id The membership ID for the current view.
* @since TBD
*/
if ( apply_filters( 'pmpro_approvals_show_level_confirmation_message', false, $pmpro_invoice->membership_id ) ) {
// Add the level confirmation message if set.
$level_message = $wpdb->get_var("SELECT confirmation FROM $wpdb->pmpro_membership_levels WHERE id = '" . intval( $pmpro_invoice->membership_id ) . "' LIMIT 1");

if ( ! empty( $level_message ) ) {
$confirmation_message .= wpautop( stripslashes( $level_message ) );
}
}

$confirmation_message .= '<p>' . sprintf( __( 'Below are details about your membership account and a receipt for your initial membership invoice. A welcome email with a copy of your initial membership invoice has been sent to %s.', 'pmpro-approvals' ), $current_user->user_email ) . '</p>';

return $confirmation_message;
Expand Down

0 comments on commit 1a8ac70

Please sign in to comment.