AbstractMembershipEmail.php
18 hours ago
EmailDataTrait.php
1 year ago
NewOrderAdminNotification.php
2 years ago
NewOrderReceipt.php
2 years ago
RenewalOrderReceipt.php
2 years ago
SubscriptionAfterExpiredNotification.php
1 year ago
SubscriptionCancelledNotification.php
2 years ago
SubscriptionCompletedNotification.php
2 years ago
SubscriptionExpirationReminder.php
3 months ago
SubscriptionExpiredNotification.php
1 year ago
SubscriptionRenewalReminder.php
3 months ago
index.php
3 years ago
EmailDataTrait.php
217 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePress\Core\Membership\Emails; |
| 4 | |
| 5 | trait EmailDataTrait |
| 6 | { |
| 7 | public function get_order_placeholders() |
| 8 | { |
| 9 | return apply_filters('ppress_email_order_placeholder_definitions', [ |
| 10 | '{{email}}' => esc_html__('Email address of the customer.', 'wp-user-avatar'), |
| 11 | '{{first_name}}' => esc_html__('First name of the customer.', 'wp-user-avatar'), |
| 12 | '{{last_name}}' => esc_html__('Last name of the customer.', 'wp-user-avatar'), |
| 13 | '{{field_key}}' => sprintf( |
| 14 | esc_html__('User custom profile field information. Replace "field_key" with the %scustom field key%s or usermeta key.', 'wp-user-avatar'), |
| 15 | '<a href="' . PPRESS_CUSTOM_FIELDS_SETTINGS_PAGE . '" target="_blank">', '</a>' |
| 16 | ), |
| 17 | '{{customer_id}}' => esc_html__('ID of the customer.', 'wp-user-avatar'), |
| 18 | '{{billing_address}}' => esc_html__("Customer's billing address.", 'wp-user-avatar'), |
| 19 | '{{billing_phone}}' => esc_html__("Customer's phone number.", 'wp-user-avatar'), |
| 20 | '{{customer_tax_id}}' => esc_html__("Customer's Tax ID.", 'wp-user-avatar'), |
| 21 | '{{order_id}}' => esc_html__("Order ID.", 'wp-user-avatar'), |
| 22 | '{{downloads_url}}' => esc_html__("URL to view and download order's digital products.", 'wp-user-avatar'), |
| 23 | '{{order_url}}' => esc_html__("URL to view order.", 'wp-user-avatar'), |
| 24 | '{{plan_name}}' => esc_html__("Name or title of plan ordered.", 'wp-user-avatar'), |
| 25 | '{{order_coupon}}' => esc_html__("Coupon code used for the order.", 'wp-user-avatar'), |
| 26 | '{{order_subtotal}}' => esc_html__("Order price before taxes.", 'wp-user-avatar'), |
| 27 | '{{order_tax}}' => esc_html__("The taxed amount of the order.", 'wp-user-avatar'), |
| 28 | '{{order_total}}' => esc_html__("Total order amount that was paid.", 'wp-user-avatar'), |
| 29 | '{{order_date}}' => esc_html__("Order date.", 'wp-user-avatar'), |
| 30 | '{{order_payment_method}}' => esc_html__("Order payment method.", 'wp-user-avatar'), |
| 31 | '{{purchase_note}}' => esc_html__("The purchase note of ordered plan.", 'wp-user-avatar'), |
| 32 | '{{site_title}}' => esc_html__('Name or title of this website.', 'wp-user-avatar'), |
| 33 | '{{business_name}}' => sprintf( |
| 34 | esc_html__('Your business name as defined in %sSettings%s.', 'wp-user-avatar'), |
| 35 | '<a target="_blank" href="' . PPRESS_SETTINGS_SETTING_GENERAL_PAGE . '#business_info">', '</a>' |
| 36 | ), |
| 37 | '{{business_address}}' => sprintf( |
| 38 | esc_html__('Your business address as defined in %sSettings%s.', 'wp-user-avatar'), |
| 39 | '<a target="_blank" href="' . PPRESS_SETTINGS_SETTING_GENERAL_PAGE . '#business_info">', '</a>' |
| 40 | ), |
| 41 | '{{business_tax_id}}' => sprintf( |
| 42 | esc_html__('Your business Tax ID as defined in %sSettings%s.', 'wp-user-avatar'), |
| 43 | '<a target="_blank" href="' . PPRESS_SETTINGS_SETTING_GENERAL_PAGE . '#business_info">', '</a>' |
| 44 | ), |
| 45 | '{{password_reset_link}}' => esc_html__('URL to reset password.', 'wp-user-avatar'), |
| 46 | '{{login_link}}' => esc_html__('URL to login.', 'wp-user-avatar'), |
| 47 | ]); |
| 48 | } |
| 49 | |
| 50 | public function get_subscription_placeholders() |
| 51 | { |
| 52 | return [ |
| 53 | '{{email}}' => esc_html__('Email address of the customer.', 'wp-user-avatar'), |
| 54 | '{{first_name}}' => esc_html__('First name of the customer.', 'wp-user-avatar'), |
| 55 | '{{last_name}}' => esc_html__('Last name of the customer.', 'wp-user-avatar'), |
| 56 | '{{subscription_id}}' => esc_html__("Subscription ID.", 'wp-user-avatar'), |
| 57 | '{{subscription_url}}' => esc_html__("URL to view subscription.", 'wp-user-avatar'), |
| 58 | '{{renew_subscription_url}}' => esc_html__("URL to re-subscribe to the membership plan.", 'wp-user-avatar'), |
| 59 | '{{plan_name}}' => esc_html__("Name or title of membership plan.", 'wp-user-avatar'), |
| 60 | '{{amount}}' => esc_html__("The recurring amount of the subscription.", 'wp-user-avatar'), |
| 61 | '{{expiration_date}}' => esc_html__("The expiration or renewal date for the subscription.", 'wp-user-avatar'), |
| 62 | '{{site_title}}' => esc_html__('Name or title of this website.', 'wp-user-avatar') |
| 63 | ]; |
| 64 | } |
| 65 | |
| 66 | public function get_order_receipt_content($renewal = false) |
| 67 | { |
| 68 | ob_start(); |
| 69 | ?> |
| 70 | <p>Hi {{first_name}},</p> |
| 71 | <?php if ( ! $renewal) : ?> |
| 72 | <p>Your order has successfully been processed.</p> |
| 73 | <?php else : ?> |
| 74 | <p>Your renewal order in the amount of {{order_total}} for {{plan_name}} has been successfully processed.</p> |
| 75 | <?php endif; ?> |
| 76 | <table style="table-layout: fixed; width: 100%; font-size: 15px; box-sizing: border-box!important; padding: 0;" width="100%" cellspacing="0" cellpadding="0"> |
| 77 | <thead style="box-sizing: border-box!important;"> |
| 78 | <tr> |
| 79 | <td style="border-top-width: 1px; border-top-color: #edeff2; border-bottom-width: 1px; border-bottom-color: #edeff2; box-sizing: border-box!important; word-break: break-word; margin: 0; padding: 15px 0; border-style: dotted none solid;" colspan="2" valign="top"> |
| 80 | <h1 style="box-sizing: border-box!important; margin-top: 0; margin-bottom: 10px; font-size: 20px; font-weight: bold;" align="left"> |
| 81 | Invoice</h1> |
| 82 | <span style="box-sizing: border-box!important;">Order: {{order_id}}</span><br/><span style="box-sizing: border-box!important;">Date: {{order_date}}</span> |
| 83 | </td> |
| 84 | </tr> |
| 85 | </thead> |
| 86 | <tbody style="box-sizing: border-box!important;"> |
| 87 | <tr> |
| 88 | <td valign="top" style="font-size: 16px; word-break: break-word; margin: 0; padding: 0 5px 15px 0; border: none; box-sizing: border-box;"> |
| 89 | <p align="left" style="display: block; font-size: 12px; font-weight: bold; line-height: 1.5em; margin: 15px 0 0; box-sizing: border-box;"> |
| 90 | Billed from</p> |
| 91 | <p align="left" style="font-size: 15px; line-height: 1.5em; margin: 5px 0 0; box-sizing: border-box;"> |
| 92 | {{business_name}}</p> |
| 93 | <p style="font-style: normal; font-size: 13px; line-height: 16px;margin: 5px 0 0; box-sizing: border-box;"> |
| 94 | {{business_address}}</p> |
| 95 | <p align="left" style="font-size: 15px; line-height: 1.5em; margin: 5px 0 0; box-sizing: border-box;"> |
| 96 | Tax ID: {{business_tax_id}}</p> |
| 97 | </td> |
| 98 | <td style="box-sizing: border-box!important; word-break: break-word; margin: 0; padding: 0 0 15px; border: none;" valign="top"> |
| 99 | <p style="display: block; font-size: 12px; font-weight: bold; box-sizing: border-box!important; line-height: 1.5em; margin: 15px 0 0;" align="left"> |
| 100 | Billed to</p> |
| 101 | <p align="left" style="font-size: 15px; line-height: 1.5em; margin: 5px 0 0; box-sizing: border-box;"> |
| 102 | {{first_name}} {{last_name}}</p> |
| 103 | <p style="font-style: normal; font-size: 13px; line-height: 16px;margin: 5px 0 0; box-sizing: border-box;"> |
| 104 | {{billing_address}}</p> |
| 105 | <p align="left" style="font-size: 15px; line-height: 1.5em; margin: 5px 0 0; box-sizing: border-box;"> |
| 106 | Tax ID: {{customer_tax_id}}</p> |
| 107 | </td> |
| 108 | </tr> |
| 109 | </tbody> |
| 110 | </table> |
| 111 | <table style="width: 100%; font-size: 15px; box-sizing: border-box!important; margin: 0; padding: 25px 0 0;" width="100%" cellspacing="0" cellpadding="0"> |
| 112 | <tbody> |
| 113 | <tr> |
| 114 | <td style="box-sizing: border-box!important; word-break: break-word; margin: 0; padding: 0; border: none;" colspan="2"> |
| 115 | <table style="width: 100%; box-sizing: border-box!important; margin: 0; padding: 0;" width="100%" cellspacing="0" cellpadding="0"> |
| 116 | <tbody> |
| 117 | <tr> |
| 118 | <th style="border-bottom-width: 1px; border-bottom-color: #edeff2; border-bottom-style: solid; box-sizing: border-box!important; padding: 0 0 8px;"> |
| 119 | <p style="font-size: 12px; font-weight: bold; box-sizing: border-box!important; line-height: 1.5em; margin: 15px 0 0;" align="left"> |
| 120 | Plan</p> |
| 121 | </th> |
| 122 | <th style="border-bottom-width: 1px; border-bottom-color: #edeff2; border-bottom-style: solid; box-sizing: border-box!important; padding: 0 0 8px;"> |
| 123 | <p style="font-size: 12px; font-weight: bold; box-sizing: border-box!important; line-height: 1.5em; margin: 15px 0 0;" align="right"> |
| 124 | Amount</p> |
| 125 | </th> |
| 126 | </tr> |
| 127 | <tr> |
| 128 | <td style="font-size: 15px; line-height: 18px; box-sizing: border-box!important; word-break: break-word; margin: 0; padding: 10px 0; border: none;" width="75%"> |
| 129 | {{plan_name}} |
| 130 | </td> |
| 131 | <td style="box-sizing: border-box!important; word-break: break-word; margin: 0; padding: 0; border: none;" align="right" width="25%"> |
| 132 | {{order_total}} |
| 133 | </td> |
| 134 | </tr> |
| 135 | </tbody> |
| 136 | </table> |
| 137 | </td> |
| 138 | </tr> |
| 139 | </tbody> |
| 140 | </table> |
| 141 | <p>{{purchase_note}}</p> |
| 142 | <div style="margin:30px 0 0;padding: 10px 0 50px 0; text-align: center;"> |
| 143 | <a style="background: #555555; color: #fff; padding: 12px 30px; text-decoration: none; border-radius: 3px; letter-spacing: 0.3px;" href="{{order_url}}">View |
| 144 | order details</a> |
| 145 | </div> |
| 146 | <?php |
| 147 | return ob_get_clean(); |
| 148 | } |
| 149 | |
| 150 | public function get_subscription_cancelled_content() |
| 151 | { |
| 152 | ob_start(); |
| 153 | ?> |
| 154 | <p>Hi {{first_name}},</p> |
| 155 | <p>Your subscription for {{plan_name}} has been cancelled.</p> |
| 156 | <?php |
| 157 | return ob_get_clean(); |
| 158 | } |
| 159 | |
| 160 | public function get_subscription_completed_content() |
| 161 | { |
| 162 | ob_start(); |
| 163 | ?> |
| 164 | <p>Hi {{first_name}},</p> |
| 165 | <p>Your subscription for {{plan_name}} is now complete.</p> |
| 166 | <?php |
| 167 | return ob_get_clean(); |
| 168 | } |
| 169 | |
| 170 | public function get_subscription_expired_content() |
| 171 | { |
| 172 | ob_start(); |
| 173 | ?> |
| 174 | <p>Hi {{first_name}},</p> |
| 175 | <p>Your subscription for {{plan_name}} has now expired. If you'd like to renew it, please click below to |
| 176 | subscribe again.</p> |
| 177 | <div style="margin:30px 0 0;padding: 10px 0 50px 0; text-align: center;"> |
| 178 | <a style="background: #555555; color: #fff; padding: 12px 30px; text-decoration: none; border-radius: 3px; letter-spacing: 0.3px;" href="{{renew_subscription_url}}">Renew |
| 179 | your subscription</a> |
| 180 | </div> |
| 181 | <?php |
| 182 | return ob_get_clean(); |
| 183 | } |
| 184 | |
| 185 | public function get_subscription_renewal_reminder_content($expiration = false) |
| 186 | { |
| 187 | ob_start(); |
| 188 | ?> |
| 189 | <p>Hi {{first_name}},</p> |
| 190 | <?php if ( ! $expiration) : ?> |
| 191 | <p>This is to inform you that your subscription for {{plan_name}} will renew on {{expiration_date}}.</p> |
| 192 | <?php |
| 193 | else : ?> |
| 194 | <p>This is to inform you that your subscription for {{plan_name}} will expire on {{expiration_date}}.</p> |
| 195 | <?php endif; ?> |
| 196 | <div style="margin:30px 0 0;padding: 10px 0 50px 0; text-align: center;"> |
| 197 | <a style="background: #555555; color: #fff; padding: 12px 30px; text-decoration: none; border-radius: 3px; letter-spacing: 0.3px;" href="{{subscription_url}}">View |
| 198 | subscription</a> |
| 199 | </div> |
| 200 | <?php |
| 201 | return ob_get_clean(); |
| 202 | } |
| 203 | |
| 204 | public function get_new_order_admin_notification_content() |
| 205 | { |
| 206 | ob_start(); |
| 207 | ?> |
| 208 | <h1>New Order</h1> |
| 209 | <p>{{first_name}} ({{email}}) purchased {{plan_name}} for {{order_total}}.</p> |
| 210 | <div style="margin:30px 0 0;padding: 10px 0 50px 0; text-align: center;"> |
| 211 | <a style="background: #555555; color: #fff; padding: 12px 30px; text-decoration: none; border-radius: 3px; letter-spacing: 0.3px;" href="{{order_url}}">View |
| 212 | order details</a> |
| 213 | </div> |
| 214 | <?php |
| 215 | return ob_get_clean(); |
| 216 | } |
| 217 | } |