PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/admin/views/setup/steps/emails.php +127 -15 4.4.44.4.8 View file →
@@ -1,24 +1,136 @@
1 1 <?php
2 2 /**
3 - * Template for displaying finish step.
3 + * Template for displaying email notifications step.
4 4 *
5 - * @author ThimPres
5 + * @author ThimPress
6 6 * @package LearnPress/Admin/Views
7 - * @version 3.0.0
7 + * @version 4.0.0
8 8 */
9 9
10 -defined( 'ABSPATH' ) or exit;
10 +use LearnPress\TemplateHooks\Admin\AdminTemplate;
11 +
12 +defined( 'ABSPATH' ) || exit;
13 +
14 +$email_notifications = array(
15 + array(
16 + 'name' => __( 'New Order Email', 'learnpress' ),
17 + 'description' => __( 'Sent to admin & instructor when a new order is placed.', 'learnpress' ),
18 + 'key' => 'new_order',
19 + 'email_ids' => array( 'new-order-admin', 'new-order-instructor' ),
20 + ),
21 + array(
22 + 'name' => __( 'Order Completed Email', 'learnpress' ),
23 + 'description' => __( 'Sent to student when payment is confirmed.', 'learnpress' ),
24 + 'key' => 'order_completed',
25 + 'email_ids' => array( 'completed-order-user' ),
26 + ),
27 + array(
28 + 'name' => __( 'Course Enrolled Email', 'learnpress' ),
29 + 'description' => __( 'Sent to student when enrolled into a course.', 'learnpress' ),
30 + 'key' => 'course_enrolled',
31 + 'email_ids' => array( 'enrolled-course-user' ),
32 + ),
33 + array(
34 + 'name' => __( 'Course Completed Email', 'learnpress' ),
35 + 'description' => __( 'Sent to student upon finishing a course.', 'learnpress' ),
36 + 'key' => 'course_completed',
37 + 'email_ids' => array( 'finished-course-user' ),
38 + ),
39 + array(
40 + 'name' => __( 'Become Instructor Request', 'learnpress' ),
41 + 'description' => __( 'Sent to admin when a user applies to become a teacher.', 'learnpress' ),
42 + 'key' => 'become_instructor_request',
43 + 'email_ids' => array( 'become-an-instructor' ),
44 + ),
45 + array(
46 + 'name' => __( 'Become Instructor Accepted', 'learnpress' ),
47 + 'description' => __( 'Sent to applicant when approved.', 'learnpress' ),
48 + 'key' => 'become_instructor_accepted',
49 + 'email_ids' => array( 'instructor-accepted' ),
50 + ),
51 +);
52 +
53 +$enabled_notifications = 0;
54 +foreach ( $email_notifications as &$email_notification ) {
55 + $email_notification['enabled'] = true;
56 + foreach ( $email_notification['email_ids'] as $email_id ) {
57 + $email = LP_Emails::get_email( $email_id );
58 + if ( ! $email || ! $email->enable() ) {
59 + $email_notification['enabled'] = false;
60 + break;
61 + }
62 + }
63 +
64 + if ( $email_notification['enabled'] ) {
65 + ++$enabled_notifications;
66 + }
67 +}
68 +unset( $email_notification );
69 +
70 +$has_enabled_notifications = $enabled_notifications === count( $email_notifications );
11 71 ?>
12 -<h2><?php _e( 'Emails system', 'learnpress' ); ?></h2>
13 72
14 -<p><?php _e( 'Emails are sent to users or teachers for each particular action.', 'learnpress' ); ?></p>
15 -<p><?php _e( 'You can enable/disable each email in your LearnPress settings later.', 'learnpress' ); ?></p>
16 -<p><?php _e( 'But right now, you can enable all emails to see how emails work.', 'learnpress' ); ?></p>
17 -<p><?php _e( 'You can skip to the next step if you don’t want to.', 'learnpress' ); ?></p>
73 +<div class="lp-setup-emails">
74 + <div class="lp-setup-section-header">
75 + <h2><?php esc_html_e( 'Step 4: Email Notifications', 'learnpress' ); ?></h2>
18 76
19 -<p>
20 - <label>
21 - <input type="checkbox" name="settings[emails][enable]" value="yes">
22 - <?php _e( 'Enable emails', 'learnpress' ); ?>
23 - </label>
24 -</p>
77 + <p>
78 + <?php esc_html_e(
79 + 'Configure automated email notifications sent to students and instructors.',
80 + 'learnpress'
81 + ); ?>
82 + </p>
83 + </div>
84 +
85 + <div class="lp-setup-emails__master lp-setup-card">
86 + <div class="lp-setup-emails__master-content">
87 + <span class="lp-setup-emails__mail-icon lp-icon-envelope-o" aria-hidden="true"></span>
88 +
89 + <strong>
90 + <?php esc_html_e( 'Enable All Email Notifications', 'learnpress' ); ?>
91 + </strong>
92 + </div>
93 +
94 + <span class="screen-reader-text"><?php esc_html_e( 'Enable all email notifications', 'learnpress' ); ?></span>
95 + <?php echo AdminTemplate::html_toggle_enable( array( 'name' => 'email_notifications_master', 'value' => $has_enabled_notifications, 'classes' => 'lp-setup-email-master' ) ); ?>
96 + </div>
97 +
98 + <div class="lp-setup-emails__table-wrap lp-setup-card">
99 + <table class="lp-setup-emails__table">
100 + <thead>
101 + <tr>
102 + <th>
103 + <?php esc_html_e( 'Email Notification Type', 'learnpress' ); ?>
104 + </th>
105 +
106 + <th>
107 + <?php esc_html_e( 'Description', 'learnpress' ); ?>
108 + </th>
109 +
110 + <th>
111 + <?php esc_html_e( 'Status', 'learnpress' ); ?>
112 + </th>
113 + </tr>
114 + </thead>
115 +
116 + <tbody>
117 + <?php foreach ( $email_notifications as $email ) : ?>
118 + <tr>
119 + <td class="lp-setup-emails__name">
120 + <?php echo esc_html( $email['name'] ); ?>
121 + </td>
122 +
123 + <td class="lp-setup-emails__description">
124 + <?php echo esc_html( $email['description'] ); ?>
125 + </td>
126 +
127 + <td class="lp-setup-emails__status">
128 + <span class="screen-reader-text"><?php echo esc_html( sprintf( __( 'Enable %s', 'learnpress' ), $email['name'] ) ); ?></span>
129 + <?php echo AdminTemplate::html_toggle_enable( array( 'name' => sprintf( 'settings[emails][notifications][%s]', $email['key'] ), 'value' => $email['enabled'], 'classes' => 'lp-setup-email-notification' ) ); ?>
130 + </td>
131 + </tr>
132 + <?php endforeach; ?>
133 + </tbody>
134 + </table>
135 + </div>
136 +</div>