Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/paid-memberships-pro/pages/confirmation.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + /**
3 + * Template: Confirmation
4 + * Version: 3.1
5 + *
6 + * See documentation for how to override the PMPro templates.
7 + * @link https://www.paidmembershipspro.com/documentation/templates/
8 + *
9 + * @version 3.1
10 + *
11 + * @author Paid Memberships Pro
12 + */
13 + global $wpdb, $pmpro_invoice, $pmpro_msg, $pmpro_msgt;
14 +
15 + // If this file is loaded, $pmpro_invoice should have been set by preheaders/confirmation.php. If not, show an error.
16 + // Below, we should still check if $pmpro_invoice is empty as there are edge cases such as saving a page with the Confirmation block in the block editor.
17 + if ( empty( $pmpro_invoice ) ) {
18 + $pmpro_msg = __( 'There was an error retrieving your order. Please contact the site owner.', 'paid-memberships-pro' );
19 + $pmpro_msgt = 'pmpro_error';
20 + }
21 +
22 + // Output page contents.
23 + ?>
24 + <div class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro' ) ); ?>">
25 + <section <?php echo ! empty( $pmpro_invoice ) ? 'id="pmpro_confirmation-' . esc_attr( intval( $pmpro_invoice->membership_id ) ) . '" ' : ''; ?>class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_section' ) ); ?>">
26 + <?php
27 + // Show message if it was passed in.
28 + if ( $pmpro_msg ) {
29 + ?>
30 + <div class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_message ' . $pmpro_msgt, $pmpro_msgt ) ); ?>"><?php echo wp_kses_post( $pmpro_msg );?></div>
31 + <?php
32 + }
33 +
34 + // Check that we have an order.
35 + if ( ! empty( $pmpro_invoice ) ) {
36 + $pmpro_invoice->getUser();
37 + $pmpro_invoice->getMembershipLevel();
38 + if ( ! empty( $pmpro_invoice->user ) && ! empty( $pmpro_invoice->membership_level ) ) {
39 + $pmpro_invoice->user->membership_level = $pmpro_invoice->membership_level; // Backwards compatibility.
40 + }
41 +
42 + // Start building the confirmation message.
43 + if ( 'success' != $pmpro_invoice->status ) {
44 + $confirmation_message = '<p>' . sprintf(__('Thank you for your membership to %1$s. Your %2$s membership will be activated once the payment has been completed.', 'paid-memberships-pro' ), get_bloginfo("name"), $pmpro_invoice->membership_level->name) . '</p>';
45 + } else {
46 + $confirmation_message = '<p>' . sprintf(__('Thank you for your membership to %s. Your %s membership is now active.', 'paid-memberships-pro' ), get_bloginfo("name"), $pmpro_invoice->membership_level->name) . '</p>';
47 + }
48 +
49 + // Add the level confirmation message if set.
50 + $level_message = $wpdb->get_var("SELECT confirmation FROM $wpdb->pmpro_membership_levels WHERE id = '" . intval( $pmpro_invoice->membership_id ) . "' LIMIT 1");
51 + if ( ! empty( $level_message ) ) {
52 + $confirmation_message .= wpautop( stripslashes( $level_message ) );
53 + }
54 +
55 + // Add some details to the confirmation message about the order.
56 + if ( ! pmpro_isLevelFree( $pmpro_invoice->membership_level ) ) {
57 + $confirmation_message .= '<p>' . sprintf( __( 'Below are details about your membership account and a receipt for your initial membership order. A welcome email with a copy of your initial membership order has been sent to %s.', 'paid-memberships-pro' ), $pmpro_invoice->user->user_email ) . '</p>';
58 + } else {
59 + $confirmation_message .= '<p>' . sprintf( __( 'Below are details about your membership account. A welcome email has been sent to %s.', 'paid-memberships-pro' ), $pmpro_invoice->user->user_email ) . '</p>';
60 + }
61 +
62 + /**
63 + * Allow devs to filter the confirmation message.
64 + * We also have a function in includes/filters.php that applies the the_content filters to this message.
65 + * @param string $confirmation_message The confirmation message.
66 + * @param object $pmpro_invoice The PMPro Order object.
67 + */
68 + $confirmation_message = apply_filters( "pmpro_confirmation_message", $confirmation_message, $pmpro_invoice );
69 + echo wp_kses_post( $confirmation_message );
70 +
71 + // Show a message about account activation if the order is not yet successful.
72 + if ( 'success' != $pmpro_invoice->status ) {
73 + ?>
74 + <div class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_spacer' ) ); ?>"></div>
75 + <div class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_message pmpro_alert' ) ); ?>">
76 + <?php
77 + /**
78 + * Filter to change the message shown when the order is not successful.
79 + *
80 + * @since 3.1
81 + *
82 + * @param string $message The message to show.
83 + * @param object $pmpro_invoice The PMProOrder object.
84 + *
85 + * @return string $message The message to show.
86 + */
87 + echo wp_kses_post( apply_filters( 'pmpro_confirmation_payment_incomplete_message', __( 'We are waiting for your payment to be completed.', 'paid-memberships-pro' ), $pmpro_invoice ) );
88 + ?>
89 + </div> <!-- pmpro_message -->
90 + <?php
91 + }
92 +
93 + if ( pmpro_isLevelFree( $pmpro_invoice->membership_level ) ) {
94 + // The invoice is free, so we don't need to show a full order.
95 + ?>
96 + <div class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_spacer' ) ); ?>"></div>
97 + <div class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_card' ) ); ?>">
98 + <h3 class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_card_title pmpro_font-large pmpro_heading-with-avatar' ) ); ?>">
99 + <?php echo get_avatar( $pmpro_invoice->user->ID, 48 ); ?>
100 + <?php
101 + /* translators: the current user's display name */
102 + printf( esc_html__( 'Welcome, %s', 'paid-memberships-pro' ), esc_html( $pmpro_invoice->user->display_name ) );
103 + ?>
104 + </h3>
105 + <div class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_card_content' ) ); ?>">
106 + <ul class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_list pmpro_list-plain' ) ); ?>">
107 + <li class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_list_item' ) ); ?>"><strong><?php esc_html_e( 'Username', 'paid-memberships-pro' ); ?>:</strong> <?php echo esc_html( $pmpro_invoice->user->user_login ); ?></li>
108 + <li class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_list_item' ) ); ?>"><strong><?php esc_html_e( 'Email', 'paid-memberships-pro' );?>:</strong> <?php echo esc_html( $pmpro_invoice->user->user_email ); ?></li>
109 + <li class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_list_item' ) ); ?>">
110 + <strong><?php esc_html_e('Membership Level', 'paid-memberships-pro' );?>:</strong>
111 + <?php echo empty( $pmpro_invoice->membership_level ) ? esc_html__( 'Pending', 'paid-memberships-pro' ) : esc_html( $pmpro_invoice->membership_level->name ); ?>
112 + </li>
113 + <?php
114 + /**
115 + * Filter to show/hide the expiration date on the confirmation page if membership is hourly.
116 + *
117 + * @param bool $show_expiration_date True to show the expiration date, false to hide it.
118 + * @param object $user The user object.
119 + * @return bool $show_expiration_date True to show the expiration date, false to hide it.
120 + */
121 + if ( ! empty( $pmpro_invoice->membership_level->expiration_period ) && $pmpro_invoice->membership_level->expiration_period == 'Hour' && apply_filters( 'pmpro_confirmation_display_hour_expiration', true, $pmpro_invoice->user ) ) {
122 + ?>
123 + <li class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_list_item' ) ); ?>"><strong><?php esc_html_e( 'Expires In', 'paid-memberships-pro' );?>:</strong> <?php echo esc_html( $pmpro_invoice->membership_level->expiration_number . ' ' . pmpro_translate_billing_period( $pmpro_invoice->membership_level->expiration_period, $pmpro_invoice->membership_level->expiration_number ) ); ?></li>
124 + <?php
125 + }
126 + ?>
127 + </ul>
128 + </div> <!-- end pmpro_card_content -->
129 + </div> <!-- end pmpro_card -->
130 + <div class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_actions_nav' ) ); ?>">
131 + <span class="<?php echo esc_attr( pmpro_get_element_class( 'pmpro_actions_nav-right' ) ); ?>"><a href="<?php echo esc_url( pmpro_url( 'account' ) ); ?>"><?php esc_html_e( 'View Your Membership Account &rarr;', 'paid-memberships-pro' ); ?></a></span>
132 + </div> <!-- end pmpro_actions_nav -->
133 + <?php
134 + }
135 + }
136 + ?>
137 + </section> <!-- end pmpro_confirmation -->
138 + </div> <!-- end pmpro -->
139 + <?php
140 + if ( ! empty( $pmpro_invoice ) && ! pmpro_isLevelFree( $pmpro_invoice->membership_level ) ) {
141 + // If the order is not free, show the full order, but make sure we don't show $pmpro_msg again.
142 + $pmpro_msg = false;
143 + $pmpro_msgt = false;
144 + echo pmpro_loadTemplate( 'invoice' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
145 + }
146 + ?>
147 +