| @@ -18,14 +18,13 @@ | ||
| 18 | 18 | * Email Donation Receipt. |
| 19 | 19 | * |
| 20 | 20 | * Email the donation confirmation to the donor via the customizable "Donation Receipt" settings. |
| 21 | 21 | * |
| 22 | - * @since 1.0 | |
| 23 | - * | |
| 24 | 22 | * @param int $payment_id Payment ID. |
| 25 | 23 | * @param bool $admin_notice Whether to send the admin email notification or not (default: true). |
| 26 | 24 | * |
| 27 | 25 | * @return void |
| 26 | + * @since 1.0 | |
| 28 | 27 | */ |
| 29 | 28 | function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
| 30 | 29 | /** |
| 31 | 30 | * Fire the action |
| @@ -32,18 +31,18 @@ | ||
| 32 | 31 | */ |
| 33 | 32 | do_action( 'give_donation-receipt_email_notification', $payment_id ); |
| 34 | 33 | |
| 35 | 34 | // If admin notifications are on, send the admin notice. |
| 36 | - if ( $admin_notice && give_is_setting_enabled( Give_Email_Notification::get_instance('new-donation' )->get_notification_status() ) ) { | |
| 35 | + if ( $admin_notice && give_is_setting_enabled( Give_Email_Notification::get_instance( 'new-donation' )->get_notification_status() ) ) { | |
| 37 | 36 | /** |
| 38 | 37 | * Fires in the donation email receipt. |
| 39 | 38 | * |
| 40 | 39 | * When admin email notices are not disabled, you can add new email notices. |
| 41 | 40 | * |
| 42 | - * @since 1.0 | |
| 43 | - * | |
| 44 | 41 | * @param int $payment_id Payment id. |
| 45 | 42 | * @param mixed $payment_data Payment meta data. |
| 43 | + * | |
| 44 | + * @since 1.0 | |
| 46 | 45 | */ |
| 47 | 46 | do_action( 'give_new-donation_email_notification', $payment_id, give_get_payment_meta( $payment_id ) ); |
| 48 | 47 | } |
| 49 | 48 | } |
| @@ -50,13 +49,12 @@ | ||
| 50 | 49 | |
| 51 | 50 | /** |
| 52 | 51 | * Sends the Admin Sale Notification Email |
| 53 | 52 | * |
| 54 | - * @since 1.0 | |
| 55 | - * | |
| 56 | 53 | * @param int $payment_id Payment ID (default: 0) |
| 57 | 54 | * |
| 58 | 55 | * @return void |
| 56 | + * @since 1.0 | |
| 59 | 57 | */ |
| 60 | 58 | function give_admin_email_notice( $payment_id ) { |
| 61 | 59 | /** |
| 62 | 60 | * Fires in the donation email receipt. |
| @@ -62,12 +60,12 @@ | ||
| 62 | 60 | * Fires in the donation email receipt. |
| 63 | 61 | * |
| 64 | 62 | * When admin email notices are not disabled, you can add new email notices. |
| 65 | 63 | * |
| 66 | - * @since 1.0 | |
| 67 | - * | |
| 68 | 64 | * @param int $payment_id Payment id. |
| 69 | 65 | * @param mixed $payment_data Payment meta data. |
| 66 | + * | |
| 67 | + * @since 1.0 | |
| 70 | 68 | */ |
| 71 | 69 | do_action( 'give_new-donation_email_notification', $payment_id ); |
| 72 | 70 | } |
| 73 | 71 | |
| @@ -78,14 +76,14 @@ | ||
| 78 | 76 | * Get default donation notification email text |
| 79 | 77 | * |
| 80 | 78 | * Returns the stored email text if available, the standard email text if not |
| 81 | 79 | * |
| 80 | + * @return string $message | |
| 82 | 81 | * @since 1.0 |
| 83 | - * @return string $message | |
| 84 | 82 | */ |
| 85 | 83 | function give_get_default_donation_notification_email() { |
| 86 | 84 | |
| 87 | - $default_email_body = __( 'Hi there,', 'give' ) . "\n\n"; | |
| 85 | + $default_email_body = __( 'Hi there,', 'give' ) . "\n\n"; | |
| 88 | 86 | $default_email_body .= __( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' {site_url}' . ".\n\n"; |
| 89 | 87 | $default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
| 90 | 88 | $default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
| 91 | 89 | $default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
| @@ -101,14 +99,14 @@ | ||
| 101 | 99 | * Get default donation receipt email text |
| 102 | 100 | * |
| 103 | 101 | * Returns the stored email text if available, the standard email text if not |
| 104 | 102 | * |
| 103 | + * @return string $message | |
| 105 | 104 | * @since 1.3.7 |
| 106 | - * @return string $message | |
| 107 | 105 | */ |
| 108 | 106 | function give_get_default_donation_receipt_email() { |
| 109 | 107 | |
| 110 | - $default_email_body = __( 'Dear', 'give' ) . " {name},\n\n"; | |
| 108 | + $default_email_body = __( 'Dear', 'give' ) . " {name},\n\n"; | |
| 111 | 109 | $default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
| 112 | 110 | $default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
| 113 | 111 | $default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
| 114 | 112 | $default_email_body .= '<strong>' . __( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
| @@ -125,14 +123,13 @@ | ||
| 125 | 123 | |
| 126 | 124 | /** |
| 127 | 125 | * Get various correctly formatted names used in emails |
| 128 | 126 | * |
| 129 | - * @since 1.0 | |
| 130 | - * | |
| 131 | 127 | * @param array $user_info List of User Information. |
| 132 | 128 | * @param Give_Payment|bool $payment Payment Object. |
| 133 | 129 | * |
| 134 | 130 | * @return array $email_names |
| 131 | + * @since 1.0 | |
| 135 | 132 | */ |
| 136 | 133 | function give_get_email_names( $user_info, $payment = false ) { |
| 137 | 134 | $email_names = array(); |
| 138 | 135 | |
| @@ -200,74 +197,5 @@ | ||
| 200 | 197 | $email_names['fullname'] = give_get_donor_name_with_title_prefixes( $user_info['title'], $email_names['fullname'] ); |
| 201 | 198 | } |
| 202 | 199 | |
| 203 | 200 | return $email_names; |
| 204 | -} | |
| 205 | - | |
| 206 | -/** | |
| 207 | - * Send email to admin when user tries to login and restricted due to user - donor disconnection. | |
| 208 | - * | |
| 209 | - * @param int $user_id User ID. | |
| 210 | - * @param int $donor_id Donor ID. | |
| 211 | - * | |
| 212 | - * @since 1.8.14 | |
| 213 | - */ | |
| 214 | -function give_admin_email_user_donor_disconnection( $user_id, $donor_id ) { | |
| 215 | - | |
| 216 | - $user_id = absint( $user_id ); | |
| 217 | - $donor_id = absint( $donor_id ); | |
| 218 | - | |
| 219 | - // Bail Out, if user id doesn't exists. | |
| 220 | - if ( empty( $user_id ) ) { | |
| 221 | - return; | |
| 222 | - } | |
| 223 | - | |
| 224 | - // Bail Out, if donor id doesn't exists. | |
| 225 | - if ( empty( $donor_id ) ) { | |
| 226 | - return; | |
| 227 | - } | |
| 228 | - | |
| 229 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); | |
| 230 | - | |
| 231 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); | |
| 232 | - | |
| 233 | - /* translators: %s: payment id */ | |
| 234 | - $subject = __( 'Attention: User tries to login whose Donor profile is disconnected!', 'give' ); | |
| 235 | - | |
| 236 | - /** | |
| 237 | - * Filters the Donor-User Disconnection notification subject. | |
| 238 | - * | |
| 239 | - * @since 1.8.14 | |
| 240 | - */ | |
| 241 | - $subject = apply_filters( 'give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags( $subject ) ); | |
| 242 | - | |
| 243 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; | |
| 244 | - $headers .= "Reply-To: " . $from_email . "\r\n"; | |
| 245 | - $headers .= "Content-Type: text/html; charset=utf-8\r\n"; | |
| 246 | - | |
| 247 | - /** | |
| 248 | - * Filters the Donor-User Disconnection notification email headers. | |
| 249 | - * | |
| 250 | - * @since 1.8.14 | |
| 251 | - */ | |
| 252 | - $headers = apply_filters( 'give_admin_donor_user_disconnection_notification_headers', $headers ); | |
| 253 | - | |
| 254 | - $message = __( 'Hi Admin,', 'give' ) . "\n\n"; | |
| 255 | - $message .= __( 'This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give' ) . "\n\n"; | |
| 256 | - $message .= __( 'Do you want to reconnect User and Donor profile again?', 'give' ) . "\n\n"; | |
| 257 | - $message .= sprintf( | |
| 258 | - '<a href="%1$s">%2$s</a>', | |
| 259 | - esc_url( admin_url() . 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&user_id=' . $user_id . '&give-messages[]=reconnect-user' ), | |
| 260 | - __( 'Reconnect User', 'give' ) . "\n\n" | |
| 261 | - ); | |
| 262 | - $message .= __( 'Thank you,', 'give' ) . "\n\n"; | |
| 263 | - $message .= '{sitename}' . "\n"; | |
| 264 | - | |
| 265 | - $emails = Give()->emails; | |
| 266 | - $emails->__set( 'from_name', $from_name ); | |
| 267 | - $emails->__set( 'from_email', $from_email ); | |
| 268 | - $emails->__set( 'headers', $headers ); | |
| 269 | - $emails->__set( 'heading', __( 'User - Donor Profile Disconnection', 'give' ) ); | |
| 270 | - | |
| 271 | - $emails->send( give_get_admin_notice_emails(), $subject, give_do_email_tags( $message ) ); | |
| 272 | - | |
| 273 | 201 | } |