PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
← All changes | includes/admin/emails/class-email-access-email.php +34 -27 2.3.1 → 4.17.0 View file →
@@ -1,9 +1,8 @@
1 1 <?php
2 2 /**
3 3 * Email access notification
4 4 *
5 - *
6 5 * @package Give
7 6 * @subpackage Classes/Emails
8 7 * @copyright Copyright (c) 2016, GiveWP
9 8 * @license https://opensource.org/licenses/gpl-license GNU Public License
@@ -30,29 +29,31 @@
30 29 * @access public
31 30 * @since 2.0
32 31 */
33 32 public function init() {
34 - $this->load( array(
35 - 'id' => 'email-access',
36 - 'label' => __( 'Email access', 'give' ),
37 - 'description' => __( 'Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give' ),
38 - 'notification_status' => give_get_option( 'email_access', 'disabled' ),
39 - 'form_metabox_setting' => false,
40 - 'notification_status_editable' => false,
41 - 'email_tag_context' => 'donor',
42 - 'recipient_group_name' => __( 'Donor', 'give' ),
43 - 'default_email_subject' => sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ),
44 - 'default_email_message' => $this->get_default_email_message(),
45 - 'default_email_header' => __( 'Confirm Email', 'give' ),
46 - 'notices' => array(
47 - 'non-notification-status-editable' => sprintf(
48 - '%1$s <a href="%2$s">%3$s &raquo;</a>',
49 - __( 'This notification is automatically toggled based on whether the email access is enabled or not.', 'give' ),
50 - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general&section=access-control') ),
51 - __( 'Edit Setting', 'give' )
52 - )
53 - ),
54 - ) );
33 + $this->load(
34 + array(
35 + 'id' => 'email-access',
36 + 'label' => __( 'Email access', 'give' ),
37 + 'description' => __( 'Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give' ),
38 + 'notification_status' => give_get_option( 'email_access', 'disabled' ),
39 + 'form_metabox_setting' => false,
40 + 'notification_status_editable' => false,
41 + 'email_tag_context' => 'donor',
42 + 'recipient_group_name' => __( 'Donor', 'give' ),
43 + 'default_email_subject' => sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ),
44 + 'default_email_message' => $this->get_default_email_message(),
45 + 'default_email_header' => __( 'Confirm Email', 'give' ),
46 + 'notices' => array(
47 + 'non-notification-status-editable' => sprintf(
48 + '%1$s <a href="%2$s">%3$s &raquo;</a>',
49 + __( 'This notification is automatically toggled based on whether the email access is enabled or not.', 'give' ),
50 + esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=general&section=access-control' ) ),
51 + __( 'Edit Setting', 'give' )
52 + ),
53 + ),
54 + )
55 + );
55 56
56 57 add_filter( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ), 10, 2 );
57 58 add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
58 59 add_filter( 'give_email_preview_header', array( $this, 'email_preview_header' ), 10, 2 );
@@ -173,9 +174,9 @@
173 174 *
174 175 * @return string
175 176 */
176 177 public function get_default_email_message() {
177 - $message = __( 'Please click the link to access your donation history on {site_url}. If you did not request this email, please contact {admin_email}.', 'give' ) . "\n\n";
178 + $message = __( 'Please click the link to access your donation history on {site_url}. If you did not request this email, please contact {admin_email}.', 'give' ) . "\n\n";
178 179 $message .= '{email_access_link}' . "\n\n";
179 180 $message .= "\n\n";
180 181 $message .= __( 'Sincerely,', 'give' ) . "\n";
181 182 $message .= get_bloginfo( 'name' ) . "\n";
@@ -208,11 +209,11 @@
208 209 * Filter the email header
209 210 *
210 211 * @since 1.0
211 212 */
212 - $subject = apply_filters( 'give_email_access_token_heading', $subject );
213 + $subject = apply_filters( 'give_email_access_token_heading', $subject );
213 214
214 - return $subject;
215 + return $subject;
215 216 }
216 217
217 218
218 219 /**
@@ -255,8 +256,9 @@
255 256 *
256 257 * @param int $donor_id Donor ID.
257 258 * @param string $email Donor Email.
258 259 *
260 + * @since 4.16.1 Return false instead of wp_die when donor is not found.
259 261 * @since 2.0
260 262 * @access public
261 263 *
262 264 * @return bool
@@ -262,8 +264,13 @@
262 264 * @return bool
263 265 */
264 266 public function setup_email_notification( $donor_id, $email ) {
265 267 $donor = Give()->donors->get_donor_by( 'email', $email );
268 +
269 + if ( ! is_object( $donor ) || ! $donor->id ) {
270 + return false;
271 + }
272 +
266 273 $this->recipient_email = $email;
267 274
268 275 // Set email data.
269 276 $this->setup_email_data();
@@ -271,9 +278,9 @@
271 278 // Send email.
272 279 return $this->send_email_notification(
273 280 array(
274 281 'donor_id' => $donor_id,
275 - 'user_id' => $donor->user_id
282 + 'user_id' => $donor->user_id,
276 283 )
277 284 );
278 285 }
279 286
@@ -312,9 +319,9 @@
312 319 * @param Give_Email_Access_Email $email
313 320 * @return string
314 321 */
315 322 public function email_preview_header( $email_preview_header, $email ) {
316 - if( $this->config['id'] === $email->config['id'] ) {
323 + if ( $this->config['id'] === $email->config['id'] ) {
317 324 $email_preview_header = '';
318 325 }
319 326
320 327 return $email_preview_header;