diff --git a/pmpro-approvals.php b/pmpro-approvals.php index 2ec80da..008328a 100644 --- a/pmpro-approvals.php +++ b/pmpro-approvals.php @@ -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 ) ) { @@ -1458,7 +1458,21 @@ public static function pmpro_confirmation_message( $confirmation_message, $pmpro $confirmation_message .= '
' . wpautop( wp_unslash( get_option("pmpro_instructions") ) ) . '
'; } + /** + * 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 .= '

' . 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 ) . '

'; return $confirmation_message;