PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 4.0.0
WP 2FA – Two-factor authentication for WordPress v4.0.0
4.0.0 1.7.1 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.8.0 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0 3.0.1 3.1.0 3.1.1 3.1.1.2 trunk 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.7.0
wp-2fa / includes / classes / Admin / Settings / templates / email-settings.php
wp-2fa / includes / classes / Admin / Settings / templates Last commit date
about-us 5 days ago partials 5 days ago passkeys 5 days ago policies 5 days ago reports 5 days ago support 5 days ago customize-code-page.php 5 days ago customize-setup-wizard.php 5 days ago customize-user-profile.php 5 days ago customize-user-prompts.php 5 days ago email-settings.php 5 days ago general-settings.php 5 days ago generic-settings.php 5 days ago import-export.php 5 days ago index.php 5 days ago plugins-integrations.php 5 days ago providers-integrations.php 5 days ago sidebar.php 5 days ago white-labeling.php 5 days ago
email-settings.php
278 lines
1 <?php
2 /**
3 * Settings Template
4 *
5 * @package wp-2fa
6 */
7
8 use WP2FA\Admin\Settings_Page;
9 use WP2FA\Admin\Settings_Builder;
10 use WP2FA\Admin\Helpers\SMS_Templates;
11 use WP2FA\Licensing\Licensing_Factory;
12 use WP2FA\Admin\Helpers\Email_Templates;
13
14 ?>
15 <div class="settings-page" id="email-settings-wrap">
16
17 <?php
18 Settings_Builder::build_option(
19 array(
20 'parent' => \esc_html__( 'White labeling', 'wp-2fa' ),
21 'type' => 'breadcrumb',
22 'custom_class' => 'back-policies-settings-main-wrapper',
23 'default' => \esc_html__( 'Customize emails & SMS templates', 'wp-2fa' ),
24 )
25 );
26 Settings_Builder::build_option(
27 array(
28 'title' => \esc_html__( 'Customize emails & SMS templates', 'wp-2fa' ),
29 'id' => 'email-settings-tab',
30 'type' => 'tab-title',
31 )
32 );
33
34 Settings_Builder::build_option(
35 array(
36 'text' => \wp_sprintf(
37 // translators: 1. Link to documentation, 2. Link to support.
38 \esc_html__( 'Customize the Emails & SMS Templates that are sent to users. %1$s.', 'wp-2fa' ),
39 \wp_sprintf( '<a href="%s" target="_blank">%s</a>', 'https://melapress.com/support/?utm_source=plugin&utm_medium=wp2fa&utm_campaign=email_settings_doc', \esc_html__( 'Learn more', 'wp-2fa' ) )
40 ),
41 'class' => 'description-settings-card',
42 'id' => 'email-settings-tab',
43 'type' => 'description',
44 )
45 );
46
47 $vals = array(
48 array(
49 'id' => 'settings',
50 'title' => \esc_html__( 'Email settings', 'wp-2fa' ),
51 ),
52 );
53
54 // @free:start
55 $vals[] = array(
56 'id' => 'templates',
57 'title' => \esc_html__( 'Email templates', 'wp-2fa' ),
58 'locked' => true,
59 'premium_context' => 'wp-2fa-white-labeling:email-templates',
60 );
61 $vals[] = array(
62 'id' => 'sms',
63 'title' => \esc_html__( 'SMS templates', 'wp-2fa' ),
64 'locked' => true,
65 'premium_context' => 'wp-2fa-white-labeling:sms-templates',
66 );
67 // @free:end
68
69
70 Settings_Builder::build_option(
71 array(
72 'class' => 'description-settings-card',
73 'id' => 'email-settings-tab',
74 'type' => 'tabbed-navigation',
75 'option_name' => 'email-settings-tabs',
76 'values' => $vals,
77 )
78 );
79 ?>
80
81
82 <!-- ══════════════════════════════════════════════════════
83 TAB 1 Email settings
84 ══════════════════════════════════════════════════════════ -->
85 <div class="tab-panel tab-panel-settings">
86
87 <div class="settings-card">
88 <?php
89
90 Settings_Builder::build_option(
91 array(
92 'title' => \esc_html__( 'Email settings', 'wp-2fa' ),
93 'id' => 'general-settings-tab',
94 'type' => 'section-title',
95 )
96 );
97
98 Settings_Builder::build_option(
99 array(
100 'text' => \wp_sprintf(
101 // translators: 1. Link to documentation, 2. Link to support.
102 \esc_html__( 'Configure how the plugin sends 2FA emails, including the "from" name and address and a delivery test. %1$s', 'wp-2fa' ),
103 \wp_sprintf( '<a href="%s" target="_blank">%s</a>', 'https://melapress.com/support/kb/troubleshoot-2fa-email-delivery/?#utm_source=plugin&utm_medium=wp2fa&utm_campaign=guide_troubleshoot_2fa_email_delivery', \esc_html__( 'Learn more', 'wp-2fa' ) )
104 ),
105 'class' => 'description-settings-card',
106 'id' => 'general-settings-tab',
107 'type' => 'description',
108 )
109 );
110
111 Settings_Builder::build_option(
112 array(
113 'title' => \esc_html__( 'Which email address should the plugin use as a from address?', 'wp-2fa' ),
114 'id' => 'general-settings-tab',
115 'type' => 'section-sub-title',
116 )
117 );
118
119 Settings_Builder::build_option(
120 array(
121 'text' => '',
122 'class' => 'description-settings-card',
123 'id' => 'general-settings-tab',
124 'type' => 'description',
125 )
126 );
127 ?>
128 <div class="form-group settings-row">
129 <?php
130 Settings_Builder::build_option(
131 array(
132 'text' => \esc_html__( 'From email & name', 'wp-2fa' ),
133 'id' => 'email-from-label',
134 'type' => 'settings-label',
135 )
136 );
137
138 Settings_Builder::build_option(
139 array(
140 'id' => 'email_from_setting',
141 'type' => 'radio',
142 'option_name' => 'email_from_setting',
143 'default' => Email_Templates::get_wp2fa_email_templates( 'email_from_setting' ) ?: 'use-defaults',
144 'options' => array(
145 'use-defaults' => \wp_sprintf(
146 /* translators: %s: default from email address */
147 \esc_html__( 'Use the email address %s', 'wp-2fa' ),
148 '<strong>' . \sanitize_email( Settings_Page::get_default_email_address() ) . '</strong>'
149 ),
150 'use-custom-email' => \esc_html__( 'Use another email address', 'wp-2fa' ),
151 ),
152 'toggle' => array(
153 'use-defaults' => '',
154 'use-custom-email' => '#custom-from-email-wrap',
155 ),
156 )
157 );
158 ?>
159 </div>
160
161 <div id="custom-from-email-wrap" class="email_from_setting-options">
162 <?php
163 Settings_Builder::build_option(
164 array(
165 'text' => \esc_html__( 'A \'From email\' address with a domain different than that of your website domain name, or with a domain that the hosting does not relay might cause the notification emails to be blocked, marked as spam, or not delivered at all. If you are not 100% sure about this change, consult with your web host.', 'wp-2fa' ),
166 'class' => 'description-settings-card',
167 'id' => 'custom-from-email-desc',
168 'type' => 'description',
169 )
170 );
171 ?>
172 <div class="form-group settings-row">
173 <?php
174 Settings_Builder::build_option(
175 array(
176 'text' => \esc_html__( 'Email Address:', 'wp-2fa' ),
177 'id' => 'custom-from-email-address-label',
178 'type' => 'settings-label',
179 )
180 );
181 ?>
182 <div class="settings-control">
183 <?php
184 Settings_Builder::build_option(
185 array(
186 'id' => 'custom_from_email_address',
187 'type' => 'text',
188 'placeholder' => \esc_html__( 'Enter email address', 'wp-2fa' ),
189 'class' => 'form-input',
190 'option_name' => 'custom_from_email_address',
191 'default' => Email_Templates::get_wp2fa_email_templates( 'custom_from_email_address' ),
192 )
193 );
194 ?>
195 </div>
196 </div>
197 <div class="form-group settings-row">
198 <?php
199 Settings_Builder::build_option(
200 array(
201 'text' => \esc_html__( 'Display Name:', 'wp-2fa' ),
202 'id' => 'custom-from-display-name-label',
203 'type' => 'settings-label',
204 )
205 );
206 ?>
207 <div class="settings-control">
208 <?php
209 Settings_Builder::build_option(
210 array(
211 'id' => 'custom_from_display_name',
212 'type' => 'text',
213 'placeholder' => \esc_html__( 'Enter display name', 'wp-2fa' ),
214 'class' => 'form-input',
215 'option_name' => 'custom_from_display_name',
216 'default' => Email_Templates::get_wp2fa_email_templates( 'custom_from_display_name' ),
217 )
218 );
219 ?>
220 </div>
221 </div>
222 </div>
223 <?php
224
225 Settings_Builder::build_option(
226 array(
227 'text' => \esc_html__( 'The "From email" address should match your website domain. If the "from address" does not match your website domain, the emails may be blocked or marked as spam. If you are not sure about this please consult with your website administrator / developer or contact us for more information.', 'wp-2fa' ),
228 'id' => 'general-settings-tab',
229 'type' => 'tip',
230 )
231 );
232 ?>
233
234 </div><!-- /.settings-card -->
235
236 <!-- Email delivery test -->
237 <div class="settings-card delivery-test-card">
238 <?php
239
240 Settings_Builder::build_option(
241 array(
242 'title' => \esc_html__( 'Email delivery test', 'wp-2fa' ),
243 'id' => 'general-settings-tab',
244 'type' => 'section-sub-title',
245 )
246 );
247
248 Settings_Builder::build_option(
249 array(
250 'text' => \wp_sprintf(
251 // translators: 1. Link to documentation, 2. Link to support.
252 \esc_html__( 'Send a test email to confirm your site can deliver 2FA emails. If it fails, common causes are an unauthorized "from" address, an SMTP misconfiguration, or your host blocking outgoing mail. %1$s.', 'wp-2fa' ),
253 \wp_sprintf( '<a href="%s" target="_blank">%s</a>', 'https://melapress.com/support/kb/troubleshoot-2fa-email-delivery/?#utm_source=plugin&utm_medium=wp2fa&utm_campaign=guide_troubleshoot_2fa_email_delivery', \esc_html__( 'Learn more', 'wp-2fa' ) )
254 ),
255 'class' => 'description-settings-card',
256 'id' => 'general-settings-tab',
257 'type' => 'description',
258 )
259 );
260 Settings_Builder::build_option(
261 array(
262 'default' => \esc_html__( 'Test email delivery', 'wp-2fa' ),
263 'type' => 'button',
264 'class' => 'btn-outline',
265 'data_attrs' => array(
266 'nonce' => \esc_attr( \wp_create_nonce( 'wp-2fa-email' ) ),
267 'check-email-2fa' => 'true',
268 ),
269 )
270 );
271 ?>
272
273 </div>
274
275 </div><!-- /.tab-panel-settings -->
276
277 </div>
278