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-new-donor-register-email.php +49 -33 2.3.2 → 4.17.0 View file →
@@ -30,25 +30,27 @@
30 30 * @access public
31 31 * @since 2.0
32 32 */
33 33 public function init() {
34 - $this->load( array(
35 - 'id' => 'new-donor-register',
36 - 'label' => __( 'New User Registration', 'give' ),
37 - 'description' => __( 'Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give' ),
38 - 'has_recipient_field' => true,
39 - 'notification_status' => 'enabled',
40 - 'has_preview_header' => true,
41 - 'email_tag_context' => array( 'donor', 'general' ),
42 - 'form_metabox_setting' => false,
43 - 'default_email_subject' => sprintf(
44 - /* translators: %s: site name */
45 - esc_attr__( '[%s] New User Registration', 'give' ),
46 - get_bloginfo( 'name' )
47 - ),
48 - 'default_email_message' => $this->get_default_email_message(),
49 - 'default_email_header' => __( 'New User Registration', 'give' ),
50 - ) );
34 + $this->load(
35 + array(
36 + 'id' => 'new-donor-register',
37 + 'label' => __( 'New User Registration', 'give' ),
38 + 'description' => __( 'Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give' ),
39 + 'has_recipient_field' => true,
40 + 'notification_status' => 'enabled',
41 + 'has_preview_header' => true,
42 + 'email_tag_context' => array( 'donor', 'general' ),
43 + 'form_metabox_setting' => false,
44 + 'default_email_subject' => sprintf(
45 + /* translators: %s: site name */
46 + esc_attr__( '[%s] New User Registration', 'give' ),
47 + get_bloginfo( 'name' )
48 + ),
49 + 'default_email_message' => $this->get_default_email_message(),
50 + 'default_email_header' => __( 'New User Registration', 'give' ),
51 + )
52 + );
51 53
52 54 // Setup action hook.
53 55 add_action(
54 56 "give_{$this->config['id']}_email_notification",
@@ -73,9 +75,9 @@
73 75 *
74 76 * @return string
75 77 */
76 78 function get_default_email_message() {
77 - $message = esc_attr__( 'New user registration on your site {sitename}:', 'give' ) . "\r\n\r\n";
79 + $message = esc_attr__( 'New user registration on your site {sitename}:', 'give' ) . "\r\n\r\n";
78 80 $message .= esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n";
79 81 $message .= esc_attr__( 'Email: {user_email}', 'give' ) . "\r\n";
80 82
81 83 /**
@@ -101,13 +103,25 @@
101 103 *
102 104 * @return string
103 105 */
104 106 public function setup_email_notification( $user_id, $user_data ) {
107 + if ( ! is_int( $user_id ) || ! $user_id ) {
108 + wp_die(
109 + esc_html__( 'Cheatin’ uh?', 'give' ),
110 + esc_html__( 'Error', 'give' ),
111 + array(
112 + 'response' => 400,
113 + )
114 + );
115 + }
116 +
105 117 $this->setup_email_data();
106 118
107 - $this->send_email_notification( array(
108 - 'user_id' => $user_id,
109 - ) );
119 + $this->send_email_notification(
120 + array(
121 + 'user_id' => $user_id,
122 + )
123 + );
110 124 }
111 125
112 126
113 127 /**
@@ -154,9 +168,9 @@
154 168
155 169 // Remove user id query param if set from request url.
156 170 $query = remove_query_arg( array( 'user_id' ), $query );
157 171
158 - $request_url = home_url( '/?' . str_replace( '', '', $query ) );
172 + $request_url = esc_url_raw( home_url( '/?' . str_replace( '', '', $query ) ) );
159 173 ?>
160 174 <script type="text/javascript">
161 175 function change_preview() {
162 176 var transactions = document.getElementById("give_preview_email_user_id");
@@ -193,19 +207,21 @@
193 207 </label>
194 208
195 209 <?php
196 210 // The select field with 100 latest transactions
197 - echo Give()->html->select( array(
198 - 'name' => 'preview_email_user_id',
199 - 'selected' => $user_id,
200 - 'id' => 'give_preview_email_user_id',
201 - 'class' => 'give-preview-email-donor-id',
202 - 'options' => $options,
203 - 'chosen' => false,
204 - 'select_atts' => 'onchange="change_preview()"',
205 - 'show_option_all' => false,
206 - 'show_option_none' => false,
207 - ) );
211 + echo Give()->html->select(
212 + array(
213 + 'name' => 'preview_email_user_id',
214 + 'selected' => $user_id,
215 + 'id' => 'give_preview_email_user_id',
216 + 'class' => 'give-preview-email-donor-id',
217 + 'options' => $options,
218 + 'chosen' => false,
219 + 'select_atts' => 'onchange="change_preview()"',
220 + 'show_option_all' => false,
221 + 'show_option_none' => false,
222 + )
223 + );
208 224 ?>
209 225 <!-- Closing tag-->
210 226 </div>
211 227 <?php