PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.2
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.2
8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 7.8.7 7.8.6 7.8.5 All 44 releases
gamipress / includes / admin / settings / email.php

email.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 8.0.2, at includes/admin/settings/email.php

409 lines 21.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin Email Settings
4 *
5 * @package GamiPress\Admin\Settings\Email
6 * @author GamiPress <contact@gamipress.com>, Ruben Garcia <rubengcdev@gmail.com>
7 * @since 1.3.7
8 */
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Email Settings meta boxes
14 *
15 * @since 1.3.0
16 *
17 * @param array $meta_boxes
18 *
19 * @return array
20 */
21 function gamipress_settings_email_meta_boxes( $meta_boxes ) {
22
23 $meta_boxes['email-settings'] = array(
24 'title' => gamipress_dashicon( 'email-alt' ) . __( 'Emails Settings', 'gamipress' ),
25 'fields' => apply_filters( 'gamipress_email_settings_fields', array(
26 'email_template' => array(
27 'name' => __( 'Email Template', 'gamipress' ),
28 'tooltip' => __( 'The email template to be used.', 'gamipress' ),
29 'label_cb' => 'cmb_tooltip_label_cb',
30 'type' => 'select',
31 'options' => gamipress_get_email_templates(),
32 ),
33 'email_logo' => array(
34 'name' => __( 'Email Logo', 'gamipress' ),
35 'tooltip' => __( 'Upload, choose or paste the URL of the logo to be displayed at the top of the emails (not displayed in plain text template).', 'gamipress' ),
36 'label_cb' => 'cmb_tooltip_label_cb',
37 'type' => 'file',
38 ),
39 'email_from_name' => array(
40 'name' => __( 'Name', 'gamipress' ),
41 'tooltip' => __( 'Name to display as sender.', 'gamipress' ),
42 'label_cb' => 'cmb_tooltip_label_cb',
43 'type' => 'text',
44 'default_cb' => 'gamipress_site_name_default_cb',
45 ),
46 'email_from_address' => array(
47 'name' => __( 'Email Address', 'gamipress' ),
48 'tooltip' => __( 'This email address will be used as the "from" and "reply-to" address.', 'gamipress' ),
49 'label_cb' => 'cmb_tooltip_label_cb',
50 'type' => 'text',
51 'default' => get_bloginfo( 'admin_email' ),
52 ),
53 'email_footer_text' => array(
54 'name' => __( 'Email Footer Text', 'gamipress' ),
55 'tooltip' => __( 'Text to be shown at email footer.', 'gamipress' ),
56 'label_cb' => 'cmb_tooltip_label_cb',
57 'desc' => gamipress_get_pattern_tags_html( 'email_footer' ),
58 'type' => 'textarea',
59 'default' => sprintf( __( '%s - Powered by GamiPress', 'gamipress' ), '<a href="' . esc_url( home_url() ) . '">' . get_bloginfo( 'name' ) . '</a>' ),
60 ),
61 ) )
62 );
63
64 $meta_boxes['email-templates'] = array(
65 'title' => gamipress_dashicon( 'editor-table' ) . __( 'Emails Templates', 'gamipress' ),
66 'fields' => apply_filters( 'gamipress_email_templates_fields', array(
67
68 // Achievement Earned
69
70 'achievement_earned_email_actions' => array(
71 'type' => 'multi_buttons',
72 'buttons' => array(
73 'achievement-earned-email-preview' => array(
74 'label' => gamipress_dashicon( 'visibility' ) . ' ' . __( 'Preview Email', 'gamipress' ),
75 'type' => 'link',
76 'link' => admin_url( 'admin.php?gamipress-action=preview_achievement_earned_email' ),
77 'target' => '_blank',
78 ),
79 'achievement-earned-email-send' => array(
80 'label' => gamipress_dashicon( 'email-alt' ) . ' ' . __( 'Send Test Email', 'gamipress' ),
81 'type' => 'link',
82 'link' => admin_url( 'admin.php?gamipress-action=send_test_achievement_earned_email' ),
83 'target' => '_blank',
84 )
85 ),
86 ),
87 'disable_achievement_earned_email' => array(
88 'name' => __( 'Disable Emails', 'gamipress' ),
89 'tooltip' => __( 'Stop sending emails to users about new achievements earned.', 'gamipress' ),
90 'label_cb' => 'cmb_tooltip_label_cb',
91 'type' => 'checkbox',
92 'classes' => 'gamipress-switch',
93 ),
94 'achievement_earned_email_subject' => array(
95 'name' => __( 'Subject', 'gamipress' ),
96 'tooltip' => __( 'Enter the subject line for the achievement earned email.', 'gamipress' ),
97 'label_cb' => 'cmb_tooltip_label_cb',
98 'type' => 'text',
99 'default' => __( '[{site_title}] {user_first}, you unlocked the {achievement_type} {achievement_title}', 'gamipress' ),
100 ),
101 'achievement_earned_email_content' => array(
102 'name' => __( 'Content', 'gamipress' ),
103 'desc' => __( 'Available tags:', 'gamipress' ) . gamipress_get_pattern_tags_html( 'achievement_earned' ),
104 'type' => 'wysiwyg',
105 'default' =>
106 '<h2>' . __( 'Congratulations {user_first}!', 'gamipress' ) . '</h2>' . "\n"
107 . '{achievement_image}' . "\n"
108 . __( 'You unlocked the {achievement_type} {achievement_title} by completing the following steps:', 'gamipress' ) . "\n"
109 . '{achievement_steps}' . "\n\n"
110 . __( 'Best regards', 'gamipress' ),
111 ),
112
113 // Step Completed
114
115 'step_completed_email_actions' => array(
116 'type' => 'multi_buttons',
117 'buttons' => array(
118 'step-completed-email-preview' => array(
119 'label' => gamipress_dashicon( 'visibility' ) . ' ' . __( 'Preview Email', 'gamipress' ),
120 'type' => 'link',
121 'link' => admin_url( 'admin.php?gamipress-action=preview_step_completed_email' ),
122 'target' => '_blank',
123 ),
124 'step-completed-email-send' => array(
125 'label' => gamipress_dashicon( 'email-alt' ) . ' ' . __( 'Send Test Email', 'gamipress' ),
126 'type' => 'link',
127 'link' => admin_url( 'admin.php?gamipress-action=send_test_step_completed_email' ),
128 'target' => '_blank',
129 )
130 ),
131 ),
132 'disable_step_completed_email' => array(
133 'name' => __( 'Disable Emails', 'gamipress' ),
134 'tooltip' => __( 'Stop sending emails to users about new steps completed.', 'gamipress' ),
135 'label_cb' => 'cmb_tooltip_label_cb',
136 'type' => 'checkbox',
137 'classes' => 'gamipress-switch',
138 ),
139 'step_completed_email_subject' => array(
140 'name' => __( 'Subject', 'gamipress' ),
141 'tooltip' => __( 'Enter the subject line for the step completed email.', 'gamipress' ),
142 'label_cb' => 'cmb_tooltip_label_cb',
143 'type' => 'text',
144 'default' => __( '[{site_title}] {user_first}, you complete a step of the {achievement_type} {achievement_title}', 'gamipress' ),
145 ),
146 'step_completed_email_content' => array(
147 'name' => __( 'Content', 'gamipress' ),
148 'desc' => __( 'Available tags:', 'gamipress' ) . gamipress_get_pattern_tags_html( 'step_completed' ),
149 'type' => 'wysiwyg',
150 'default' =>
151 '<h2>' . __( 'Congratulations {user_first}!', 'gamipress' ) . '</h2>' . "\n"
152 . '{achievement_image}' . "\n"
153 . __( 'You completed the step "{label}" of the {achievement_type} {achievement_title}!', 'gamipress' ) . "\n\n"
154 . __( 'You need to complete the following steps to completely unlock this {achievement_type}:', 'gamipress' ) . "\n"
155 . '{achievement_steps}' . "\n\n"
156 . __( 'Best regards', 'gamipress' ),
157 ),
158
159 // Points Award Completed
160
161 'points_award_completed_email_actions' => array(
162 'type' => 'multi_buttons',
163 'buttons' => array(
164 'points-award-completed-email-preview' => array(
165 'label' => gamipress_dashicon( 'visibility' ) . ' ' . __( 'Preview Email', 'gamipress' ),
166 'type' => 'link',
167 'link' => admin_url( 'admin.php?gamipress-action=preview_points_award_completed_email' ),
168 'target' => '_blank',
169 ),
170 'points-award-completed-email-send' => array(
171 'label' => gamipress_dashicon( 'email-alt' ) . ' ' . __( 'Send Test Email', 'gamipress' ),
172 'type' => 'link',
173 'link' => admin_url( 'admin.php?gamipress-action=send_test_points_award_completed_email' ),
174 'target' => '_blank',
175 )
176 ),
177 ),
178 'disable_points_award_completed_email' => array(
179 'name' => __( 'Disable Emails', 'gamipress' ),
180 'tooltip' => __( 'Stop sending emails to users about new points awards.', 'gamipress' ),
181 'label_cb' => 'cmb_tooltip_label_cb',
182 'type' => 'checkbox',
183 'classes' => 'gamipress-switch',
184 ),
185 'points_award_completed_email_subject' => array(
186 'name' => __( 'Subject', 'gamipress' ),
187 'tooltip' => __( 'Enter the subject line for the points award email.', 'gamipress' ),
188 'label_cb' => 'cmb_tooltip_label_cb',
189 'type' => 'text',
190 'default' => __( '[{site_title}] {user_first}, you got {points} {points_type}', 'gamipress' ),
191 ),
192 'points_award_completed_email_content' => array(
193 'name' => __( 'Content', 'gamipress' ),
194 'desc' => __( 'Available tags:', 'gamipress' ) . gamipress_get_pattern_tags_html( 'points_award_completed' ),
195 'type' => 'wysiwyg',
196 'default' =>
197 '<h2>' . __( 'Congratulations {user_first}!', 'gamipress' ) . '</h2>' . "\n"
198 . __( 'You got {points} {points_type} for completing "{label}".', 'gamipress' ) . "\n"
199 . __( 'Your new {points_type} balance is:', 'gamipress' ) . "\n"
200 . '{points_balance}' . "\n\n"
201 . __( 'Best regards', 'gamipress' ),
202 ),
203
204 // Points Deduction Completed
205
206 'points_deduct_completed_email_actions' => array(
207 'type' => 'multi_buttons',
208 'buttons' => array(
209 'points-deduct-completed-email-preview' => array(
210 'label' => gamipress_dashicon( 'visibility' ) . ' ' . __( 'Preview Email', 'gamipress' ),
211 'type' => 'link',
212 'link' => admin_url( 'admin.php?gamipress-action=preview_points_deduct_completed_email' ),
213 'target' => '_blank',
214 ),
215 'points-deduct-completed-email-send' => array(
216 'label' => gamipress_dashicon( 'email-alt' ) . ' ' . __( 'Send Test Email', 'gamipress' ),
217 'type' => 'link',
218 'link' => admin_url( 'admin.php?gamipress-action=send_test_points_deduct_completed_email' ),
219 'target' => '_blank',
220 )
221 ),
222 ),
223 'disable_points_deduct_completed_email' => array(
224 'name' => __( 'Disable Emails', 'gamipress' ),
225 'tooltip' => __( 'Stop sending emails to users about new points deductions.', 'gamipress' ),
226 'label_cb' => 'cmb_tooltip_label_cb',
227 'type' => 'checkbox',
228 'classes' => 'gamipress-switch',
229 ),
230 'points_deduct_completed_email_subject' => array(
231 'name' => __( 'Subject', 'gamipress' ),
232 'tooltip' => __( 'Enter the subject line for the points deduct email.', 'gamipress' ),
233 'label_cb' => 'cmb_tooltip_label_cb',
234 'type' => 'text',
235 'default' => __( '[{site_title}] {user_first}, you lost {points} {points_type}', 'gamipress' ),
236 ),
237 'points_deduct_completed_email_content' => array(
238 'name' => __( 'Content', 'gamipress' ),
239 'desc' => __( 'Available tags:', 'gamipress' ) . gamipress_get_pattern_tags_html( 'points_deduct_completed' ),
240 'type' => 'wysiwyg',
241 'default' =>
242 '<h2>' . __( 'Oops {user_first}!', 'gamipress' ) . '</h2>' . "\n"
243 . __( 'You lost {points} {points_type} for "{label}".', 'gamipress' ) . "\n"
244 . __( 'Your new {points_type} balance is:', 'gamipress' ) . "\n"
245 . '{points_balance}' . "\n\n"
246 . __( 'Best regards', 'gamipress' ),
247 ),
248
249 // Rank Reached
250
251 'rank_earned_email_actions' => array(
252 'type' => 'multi_buttons',
253 'buttons' => array(
254 'rank-earned-email-preview' => array(
255 'label' => gamipress_dashicon( 'visibility' ) . ' ' . __( 'Preview Email', 'gamipress' ),
256 'type' => 'link',
257 'link' => admin_url( 'admin.php?gamipress-action=preview_rank_earned_email' ),
258 'target' => '_blank',
259 ),
260 'rank-earned-email-send' => array(
261 'label' => gamipress_dashicon( 'email-alt' ) . ' ' . __( 'Send Test Email', 'gamipress' ),
262 'type' => 'link',
263 'link' => admin_url( 'admin.php?gamipress-action=send_test_rank_earned_email' ),
264 'target' => '_blank',
265 )
266 ),
267 ),
268 'disable_rank_earned_email' => array(
269 'name' => __( 'Disable Emails', 'gamipress' ),
270 'tooltip' => __( 'Stop sending emails to users about new ranks reached.', 'gamipress' ),
271 'label_cb' => 'cmb_tooltip_label_cb',
272 'type' => 'checkbox',
273 'classes' => 'gamipress-switch',
274 ),
275 'rank_earned_email_subject' => array(
276 'name' => __( 'Subject', 'gamipress' ),
277 'tooltip' => __( 'Enter the subject line for the rank earned email.', 'gamipress' ),
278 'label_cb' => 'cmb_tooltip_label_cb',
279 'type' => 'text',
280 'default' => __( '[{site_title}] {user_first}, you reached the {rank_type} {rank_title}', 'gamipress' ),
281 ),
282 'rank_earned_email_content' => array(
283 'name' => __( 'Content', 'gamipress' ),
284 'desc' => __( 'Available tags:', 'gamipress' ) . gamipress_get_pattern_tags_html( 'rank_earned' ),
285 'type' => 'wysiwyg',
286 'default' =>
287 '<h2>' . __( 'Congratulations {user_first}!', 'gamipress' ) . '</h2>' . "\n"
288 . '{rank_image}' . "\n"
289 . __( 'You reached the {rank_type} {rank_title} by completing the following requirements:', 'gamipress' ) . "\n"
290 . '{rank_requirements}' . "\n\n"
291 . __( 'Best regards', 'gamipress' ),
292 ),
293
294 // Rank Requirement Completed
295
296 'rank_requirement_completed_email_actions' => array(
297 'type' => 'multi_buttons',
298 'buttons' => array(
299 'rank-requirement-completed-email-preview' => array(
300 'label' => gamipress_dashicon( 'visibility' ) . ' ' . __( 'Preview Email', 'gamipress' ),
301 'type' => 'link',
302 'link' => admin_url( 'admin.php?gamipress-action=preview_rank_requirement_completed_email' ),
303 'target' => '_blank',
304 ),
305 'rank-requirement-completed-email-send' => array(
306 'label' => gamipress_dashicon( 'email-alt' ) . ' ' . __( 'Send Test Email', 'gamipress' ),
307 'type' => 'link',
308 'link' => admin_url( 'admin.php?gamipress-action=send_test_rank_requirement_completed_email' ),
309 'target' => '_blank',
310 )
311 ),
312 ),
313 'disable_rank_requirement_completed_email' => array(
314 'name' => __( 'Disable Emails', 'gamipress' ),
315 'tooltip' => __( 'Stop sending emails to users about new rank requirements completed.', 'gamipress' ),
316 'label_cb' => 'cmb_tooltip_label_cb',
317 'type' => 'checkbox',
318 'classes' => 'gamipress-switch',
319 ),
320 'rank_requirement_completed_email_subject' => array(
321 'name' => __( 'Subject', 'gamipress' ),
322 'tooltip' => __( 'Enter the subject line for the rank requirement completed email.', 'gamipress' ),
323 'label_cb' => 'cmb_tooltip_label_cb',
324 'type' => 'text',
325 'default' => __( '[{site_title}] {user_first}, you complete a requirement of the {rank_type} {rank_title}', 'gamipress' ),
326 ),
327 'rank_requirement_completed_email_content' => array(
328 'name' => __( 'Content', 'gamipress' ),
329 'desc' => __( 'Available tags:', 'gamipress' ) . gamipress_get_pattern_tags_html( 'rank_requirement_completed' ),
330 'type' => 'wysiwyg',
331 'default' =>
332 '<h2>' . __( 'Congratulations {user_first}!', 'gamipress' ) . '</h2>' . "\n"
333 . '{rank_image}' . "\n"
334 . __( 'You completed the requirement "{label}" of the {rank_type} {rank_title}!', 'gamipress' ) . "\n\n"
335 . __( 'You need to complete the following requirements to completely reach this {rank_type}:', 'gamipress' ) . "\n"
336 . '{rank_requirements}' . "\n\n"
337 . __( 'Best regards', 'gamipress' ),
338 ),
339
340 ) ),
341 'vertical_tabs' => true,
342 'tabs' => apply_filters( 'gamipress_email_templates_tabs', array(
343 'achievement_earned' => array(
344 'title' => __( 'Achievements', 'gamipress' ),
345 'icon' => 'dashicons-awards',
346 'fields' => array(
347 'achievement_earned_email_actions',
348 'disable_achievement_earned_email',
349 'achievement_earned_email_subject',
350 'achievement_earned_email_content'
351 )
352 ),
353 'step_completed' => array(
354 'title' => __( 'Steps', 'gamipress' ),
355 'icon' => 'dashicons-editor-ol',
356 'fields' => array(
357 'step_completed_email_actions',
358 'disable_step_completed_email',
359 'step_completed_email_subject',
360 'step_completed_email_content'
361 )
362 ),
363 'points_award_completed' => array(
364 'title' => __( 'Points Awards', 'gamipress' ),
365 'icon' => 'dashicons-star-filled',
366 'fields' => array(
367 'points_award_completed_email_actions',
368 'disable_points_award_completed_email',
369 'points_award_completed_email_subject',
370 'points_award_completed_email_content'
371 )
372 ),
373 'points_deduct_completed' => array(
374 'title' => __( 'Points Deductions', 'gamipress' ),
375 'icon' => 'dashicons-star-empty',
376 'fields' => array(
377 'points_deduct_completed_email_actions',
378 'disable_points_deduct_completed_email',
379 'points_deduct_completed_email_subject',
380 'points_deduct_completed_email_content'
381 )
382 ),
383 'rank_earned' => array(
384 'title' => __( 'Ranks', 'gamipress' ),
385 'icon' => 'dashicons-rank',
386 'fields' => array(
387 'rank_earned_email_actions',
388 'disable_rank_earned_email',
389 'rank_earned_email_subject',
390 'rank_earned_email_content'
391 )
392 ),
393 'rank_requirement_completed' => array(
394 'title' => __( 'Rank Requirements', 'gamipress' ),
395 'icon' => 'dashicons-editor-ol',
396 'fields' => array(
397 'rank_requirement_completed_email_actions',
398 'disable_rank_requirement_completed_email',
399 'rank_requirement_completed_email_subject',
400 'rank_requirement_completed_email_content'
401 )
402 ),
403 ) )
404 );
405
406 return $meta_boxes;
407
408 }
409 add_filter( 'gamipress_settings_email_meta_boxes', 'gamipress_settings_email_meta_boxes' );