| 1 |
<?php |
| 2 |
/** |
| 3 |
* Registration settings partial |
| 4 |
* |
| 5 |
* @package MagicLogin\Admin |
| 6 |
*/ |
| 7 |
|
| 8 |
use function MagicLogin\Utils\get_doc_url; |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit; // Exit if accessed directly. |
| 12 |
} |
| 13 |
|
| 14 |
$settings = \MagicLogin\Utils\get_settings(); |
| 15 |
|
| 16 |
|
| 17 |
// phpcs:disable WordPress.WhiteSpace.PrecisionAlignment.Found |
| 18 |
// phpcs:disable Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed |
| 19 |
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment |
| 20 |
|
| 21 |
?> |
| 22 |
|
| 23 |
<div role="tabpanel" tabindex="0" id="registration__content" class="sui-tab-content magic-login-main-tab-content sui-disabled" aria-labelledby="registration__tab" hidden=""> |
| 24 |
<!-- Registration --> |
| 25 |
<div class="sui-box-settings-row sui-disabled"> |
| 26 |
<div class="sui-box-settings-col-1"> |
| 27 |
<span class="sui-settings-label"><?php esc_html_e( 'Registration', 'magic-login' ); ?></span> |
| 28 |
<span class="sui-description"> |
| 29 |
<?php |
| 30 |
echo wp_kses_post( |
| 31 |
sprintf( |
| 32 |
/* translators: 1: Documentation URL 2: 'Learn More' text */ |
| 33 |
__( 'Activate registration feature. <a href="%1$s" target="_blank" rel="noopener">%2$s</a>', 'magic-login' ), |
| 34 |
get_doc_url( 'docs/magic-login-registration/' ), |
| 35 |
__( 'Learn More.', 'magic-login' ) |
| 36 |
) |
| 37 |
); |
| 38 |
?> |
| 39 |
</span> </div> |
| 40 |
<div class="sui-box-settings-col-2"> |
| 41 |
<div class="sui-form-field"> |
| 42 |
<label for="registration_enable" class="sui-toggle"> |
| 43 |
<input type="checkbox" |
| 44 |
value="1" |
| 45 |
name="registration_enable" |
| 46 |
id="registration_enable" |
| 47 |
aria-labelledby="registration_enable_label" |
| 48 |
aria-controls="registration-details" |
| 49 |
<?php checked( 1, $settings['registration']['enable'] ); ?> |
| 50 |
> |
| 51 |
<span class="sui-toggle-slider" aria-hidden="true"></span> |
| 52 |
<span id="registration_enable_label" class="sui-toggle-label"><?php esc_html_e( 'Enable registration.', 'magic-login' ); ?></span> |
| 53 |
<span class="sui-description"><?php esc_html_e( 'Allow users to register your site magically.', 'magic-login' ); ?></span> |
| 54 |
</label> |
| 55 |
</div> |
| 56 |
</div> |
| 57 |
</div> |
| 58 |
|
| 59 |
<!-- Registration Mode --> |
| 60 |
<div class="sui-box-settings-row sui-disabled"> |
| 61 |
<div class="sui-box-settings-col-1"> |
| 62 |
<span class="sui-settings-label"><?php esc_html_e( 'Registration Mode', 'magic-login' ); ?></span> |
| 63 |
<span class="sui-description"><?php esc_html_e( 'Choose how you want to handle the registration process.', 'magic-login' ); ?></span> |
| 64 |
</div> |
| 65 |
<div class="sui-box-settings-col-2"> |
| 66 |
<div class="sui-form-field" role="radiogroup"> |
| 67 |
<label for="auto-registration" class="sui-radio sui-radio-stacked"> |
| 68 |
<input |
| 69 |
type="radio" |
| 70 |
value="auto" |
| 71 |
name="registration_mode" |
| 72 |
id="auto-registration" |
| 73 |
value="auto" |
| 74 |
aria-controls="auto-registration-details" |
| 75 |
<?php checked( 'auto', $settings['registration']['mode'] ); ?> |
| 76 |
> |
| 77 |
<span aria-hidden="true"></span> |
| 78 |
<span class="sui-label-inline"> |
| 79 |
<?php esc_html_e( 'Automatically register if the user enters an email address that has not registered.', 'magic-login' ); ?> |
| 80 |
</span> |
| 81 |
</label> |
| 82 |
|
| 83 |
<label for="standard-registration" class="sui-radio sui-radio-stacked"> |
| 84 |
<input |
| 85 |
type="radio" |
| 86 |
name="registration_mode" |
| 87 |
id="standard-registration" |
| 88 |
value="standard" |
| 89 |
aria-controls="standard-registration-details" |
| 90 |
|
| 91 |
<?php checked( 'standard', $settings['registration']['mode'] ); ?> |
| 92 |
> |
| 93 |
<span aria-hidden="true"></span> |
| 94 |
<span class="sui-label-inline"> |
| 95 |
<?php esc_html_e( 'Standard registration form.', 'magic-login' ); ?> |
| 96 |
<?php esc_html_e( 'The registration form will be displayed if the email address is not found during login.', 'magic-login' ); ?> |
| 97 |
</span> |
| 98 |
|
| 99 |
</label> |
| 100 |
|
| 101 |
<label for="shortcode-registration" class="sui-radio sui-radio-stacked"> |
| 102 |
<input |
| 103 |
type="radio" |
| 104 |
name="registration_mode" |
| 105 |
id="shortcode-registration" |
| 106 |
value="shortcode" |
| 107 |
aria-controls="shortcode-registration-details" |
| 108 |
<?php checked( 'shortcode', $settings['registration']['mode'] ); ?> |
| 109 |
> |
| 110 |
<span aria-hidden="true"></span> |
| 111 |
<span class="sui-label-inline"> |
| 112 |
<?php esc_html_e( 'Only with registration shortcode, do not integrate with magic login form.', 'magic-login' ); ?> |
| 113 |
</span> |
| 114 |
</label> |
| 115 |
</div> |
| 116 |
|
| 117 |
<div id="auto-registration-details" style="<?php echo( 'auto' === $settings['registration']['mode'] ? '' : 'display:none' ); ?>" tabindex="0"> |
| 118 |
<div class="sui-form-field"> |
| 119 |
<label for="fallback_email_field" class="sui-toggle"> |
| 120 |
<input type="checkbox" |
| 121 |
value="1" |
| 122 |
name="fallback_email_field" |
| 123 |
id="fallback_email_field" |
| 124 |
aria-labelledby="fallback_email_field_label" |
| 125 |
<?php checked( 1, $settings['registration']['fallback_email_field'] ); ?> |
| 126 |
> |
| 127 |
<span class="sui-toggle-slider" aria-hidden="true"></span> |
| 128 |
<span id="fallback_email_field_label" class="sui-toggle-label"> |
| 129 |
<?php esc_html_e( 'Show the email field if a username or invalid email is entered.', 'magic-login' ); ?> |
| 130 |
</span> |
| 131 |
</label> |
| 132 |
</div> |
| 133 |
</div> |
| 134 |
|
| 135 |
|
| 136 |
<div id="standard-registration-details" style="<?php echo( 'standard' === $settings['registration']['mode'] ? '' : 'display:none' ); ?>" tabindex="0"> |
| 137 |
<div class="sui-form-field"> |
| 138 |
<label for="registration_show_name_field" class="sui-toggle"> |
| 139 |
<input type="checkbox" |
| 140 |
value="1" |
| 141 |
name="registration_show_name_field" |
| 142 |
id="registration_show_name_field" |
| 143 |
aria-labelledby="registration_show_name_field_label" |
| 144 |
aria-controls="registration_name_field_details" |
| 145 |
<?php checked( 1, $settings['registration']['show_name_field'] ); ?> |
| 146 |
> |
| 147 |
<span class="sui-toggle-slider" aria-hidden="true"></span> |
| 148 |
<span id="registration_show_name_field_label" class="sui-toggle-label"> |
| 149 |
<?php esc_html_e( 'Show first name and last name fields for registration.', 'magic-login' ); ?> |
| 150 |
</span> |
| 151 |
</label> |
| 152 |
<div id="registration_name_field_details" style="<?php echo( $settings['registration']['show_name_field'] ? '' : 'display:none' ); ?>" > |
| 153 |
<label for="registration_require_name_field" class="sui-toggle"> |
| 154 |
<input type="checkbox" |
| 155 |
value="1" |
| 156 |
name="registration_require_name_field" |
| 157 |
id="registration_require_name_field" |
| 158 |
aria-labelledby="registration_require_name_field_label" |
| 159 |
<?php checked( 1, $settings['registration']['require_name_field'] ); ?> |
| 160 |
> |
| 161 |
<span class="sui-toggle-slider" aria-hidden="true"></span> |
| 162 |
<span id="registration_require_name_field_label" class="sui-toggle-label"> |
| 163 |
<?php esc_html_e( 'Mark as required.', 'magic-login' ); ?> |
| 164 |
</span> |
| 165 |
</label> |
| 166 |
</div> |
| 167 |
</div> |
| 168 |
|
| 169 |
<div class="sui-form-field"> |
| 170 |
<label for="registration_show_terms_field" class="sui-toggle"> |
| 171 |
<input type="checkbox" |
| 172 |
value="1" |
| 173 |
name="registration_show_terms_field" |
| 174 |
id="registration_show_terms_field" |
| 175 |
aria-labelledby="registration_show_terms_field_label" |
| 176 |
aria-controls="registration_terms_field_details" |
| 177 |
<?php checked( 1, $settings['registration']['show_terms_field'] ); ?> |
| 178 |
> |
| 179 |
<span class="sui-toggle-slider" aria-hidden="true"></span> |
| 180 |
<span id="registration_show_terms_field_label" class="sui-toggle-label"> |
| 181 |
<?php esc_html_e( 'Show terms field.', 'magic-login' ); ?> |
| 182 |
</span> |
| 183 |
|
| 184 |
</label> |
| 185 |
<div id="registration_terms_field_details" style="<?php echo( $settings['registration']['show_terms_field'] ? '' : 'display:none' ); ?>"> |
| 186 |
<label for="registration_require_terms_field" class="sui-toggle"> |
| 187 |
<input type="checkbox" |
| 188 |
value="1" |
| 189 |
name="registration_require_terms_field" |
| 190 |
id="registration_require_terms_field" |
| 191 |
aria-labelledby="registration_require_terms_field_label" |
| 192 |
<?php checked( 1, $settings['registration']['require_terms_field'] ); ?> |
| 193 |
> |
| 194 |
<span class="sui-toggle-slider" aria-hidden="true"></span> |
| 195 |
<span id="registration_require_terms_field_label" class="sui-toggle-label"> |
| 196 |
<?php esc_html_e( 'Mark as required.', 'magic-login' ); ?> |
| 197 |
</span> |
| 198 |
</label> |
| 199 |
<span class="sui-description"> |
| 200 |
<?php esc_html_e( 'The visitors will required to accept following terms you stated in the textarea.', 'magic-login' ); ?> |
| 201 |
</span> |
| 202 |
</div> |
| 203 |
|
| 204 |
</div> |
| 205 |
<div class="sui-form-field"> |
| 206 |
<?php |
| 207 |
\wp_editor( |
| 208 |
$settings['registration']['terms'], |
| 209 |
'registration_terms', |
| 210 |
[ |
| 211 |
'media_buttons' => false, |
| 212 |
'textarea_name' => 'registration_terms', |
| 213 |
'editor_css' => '', |
| 214 |
'editor_height' => 5, |
| 215 |
'drag_drop_upload' => false, |
| 216 |
'tinymce' => false, |
| 217 |
'teeny' => false, |
| 218 |
] |
| 219 |
); |
| 220 |
?> |
| 221 |
<span id="registration-terms-description" class="sui-description"> |
| 222 |
<?php esc_html_e( 'Enter the condition text you want the users to accept.', 'magic-login' ); ?> |
| 223 |
</span> |
| 224 |
</div> |
| 225 |
</div> |
| 226 |
|
| 227 |
<div id="shortcode-registration-details" style="<?php echo( 'shortcode' === $settings['registration']['mode'] ? '' : 'display:none' ); ?>" tabindex="0"> |
| 228 |
<div class="sui-notice sui-notice-info" style="padding: 10px 20px 10px 0; margin:0;"> |
| 229 |
<div class="sui-notice-content"> |
| 230 |
<div class="sui-notice-message"> |
| 231 |
<span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span> |
| 232 |
<p> |
| 233 |
<?php |
| 234 |
echo wp_kses_post( |
| 235 |
sprintf( |
| 236 |
/* translators: 1: Magic Login registration shortcode 2: Documentation URL 3: 'Learn More' text */ |
| 237 |
__( 'To add a registration form to any page, use the shortcode <code>%1$s</code>. <a href="%2$s" target="_blank" rel="noopener">%3$s</a>', 'magic-login' ), |
| 238 |
'[magic_login_registration_form]', |
| 239 |
get_doc_url( 'docs/magic-login-registration/' ), |
| 240 |
__( 'Learn More.', 'magic-login' ) |
| 241 |
) |
| 242 |
); |
| 243 |
?> |
| 244 |
</p> |
| 245 |
</div> |
| 246 |
</div> |
| 247 |
</div> |
| 248 |
</div> |
| 249 |
</div> |
| 250 |
</div> |
| 251 |
|
| 252 |
<!-- Allowed Domain --> |
| 253 |
<div class="sui-box-settings-row sui-disabled"> |
| 254 |
<div class="sui-box-settings-col-1"> |
| 255 |
<span class="sui-settings-label"> |
| 256 |
<?php esc_html_e( 'Domain Restriction', 'magic-login' ); ?> |
| 257 |
</span> |
| 258 |
<span id="domain-restriction-description" class="sui-description"><?php esc_html_e( 'Allow only listed domains for registration.', 'magic-login' ); ?></span> |
| 259 |
</div> |
| 260 |
<div class="sui-box-settings-col-2"> |
| 261 |
<div class="sui-form-field"> |
| 262 |
<label for="enable_registration_domain_restriction" class="sui-toggle"> |
| 263 |
<input |
| 264 |
type="checkbox" |
| 265 |
value="1" |
| 266 |
name="enable_registration_domain_restriction" |
| 267 |
id="enable_registration_domain_restriction" |
| 268 |
aria-describedby="enable-registration-domain-restriction-description" |
| 269 |
aria-controls="enable-registration-domain-restriction-controls" |
| 270 |
<?php checked( 1, $settings['registration']['enable_domain_restriction'] ); ?> |
| 271 |
> |
| 272 |
<span class="sui-toggle-slider" aria-hidden="true"></span> |
| 273 |
<span id="domain-restriction-label" class="sui-toggle-label"><?php esc_html_e( 'Enable domain restriction', 'magic-login' ); ?></span> |
| 274 |
<span class="sui-description"> |
| 275 |
</span> |
| 276 |
</label> |
| 277 |
|
| 278 |
<div style=" <?php echo( ! $settings['registration']['enable_domain_restriction'] ? 'display:none' : '' ); ?>" tabindex="0" id="enable-registration-domain-restriction-controls" class="sui-toggle-content sui-border-frame"> |
| 279 |
<div class="sui-form-field"> |
| 280 |
<textarea |
| 281 |
placeholder="example.com" |
| 282 |
id="allowed_registration_domains" |
| 283 |
name="allowed_registration_domains" |
| 284 |
class="sui-form-control" |
| 285 |
aria-describedby="allowed-domains-description" |
| 286 |
rows="7" |
| 287 |
><?php echo esc_textarea( $settings['registration']['allowed_domains'] ); ?></textarea> |
| 288 |
<span id="allowed-domains-description" class="sui-description"><?php esc_html_e( 'Enter allowed domains line by line.', 'magic-login' ); ?></span> |
| 289 |
</div> |
| 290 |
</div> |
| 291 |
</div> |
| 292 |
|
| 293 |
</div> |
| 294 |
</div> |
| 295 |
|
| 296 |
<!-- Registration Role --> |
| 297 |
<div class="sui-box-settings-row sui-disabled"> |
| 298 |
<div class="sui-box-settings-col-1"> |
| 299 |
<span class="sui-settings-label" id="registration_role_key"><?php esc_html_e( 'User Role', 'magic-login' ); ?></span> |
| 300 |
</div> |
| 301 |
|
| 302 |
<?php |
| 303 |
$roles = wp_roles()->get_names(); |
| 304 |
?> |
| 305 |
<div class="sui-box-settings-col-2"> |
| 306 |
<div class="sui-form-field"> |
| 307 |
<select name="registration_role" id="select-magic-login-registration-role" class="sui-select"> |
| 308 |
<option value=""><?php esc_html_e( 'Default role (from General Settings)', 'magic-login' ); ?></option> |
| 309 |
<?php foreach ( $roles as $role => $role_name ) : ?> |
| 310 |
<option <?php selected( $role, $settings['registration']['role'] ); ?> value="<?php echo esc_attr( $role ); ?>"> |
| 311 |
<?php echo esc_attr( translate_user_role( $role_name ) ); ?> |
| 312 |
</option> |
| 313 |
<?php endforeach; ?> |
| 314 |
</select> |
| 315 |
<span class="sui-description"><?php esc_html_e( 'Choose the default role assigned to newly registered users. If no role is selected, WordPress will use the default role from General Settings.', 'magic-login' ); ?></span> |
| 316 |
</div> |
| 317 |
</div> |
| 318 |
</div> |
| 319 |
|
| 320 |
|
| 321 |
<!-- Registration Email --> |
| 322 |
<div class="sui-box-settings-row sui-disabled"> |
| 323 |
<div class="sui-box-settings-col-1"> |
| 324 |
<span class="sui-settings-label" id="registration_email_label"><?php esc_html_e( 'Registration Email', 'magic-login' ); ?></span> |
| 325 |
</div> |
| 326 |
|
| 327 |
<div class="sui-box-settings-col-2"> |
| 328 |
<div class="sui-form-field"> |
| 329 |
<label for="registration_send_email" class="sui-toggle"> |
| 330 |
<input type="checkbox" |
| 331 |
value="1" |
| 332 |
name="registration_send_email" |
| 333 |
id="registration_send_email" |
| 334 |
aria-labelledby="registration_send_email_label" |
| 335 |
<?php checked( 1, $settings['registration']['send_email'] ); ?> |
| 336 |
> |
| 337 |
<span class="sui-toggle-slider" aria-hidden="true"></span> |
| 338 |
<span id="registration_send_email_label" class="sui-toggle-label"><?php esc_html_e( 'Send a registration email after signup.', 'magic-login' ); ?></span> |
| 339 |
</label> |
| 340 |
</div> |
| 341 |
|
| 342 |
<div class="sui-form-field"> |
| 343 |
<span class="sui-settings-label" id="registration_email_subject_label"><?php esc_html_e( 'Email Subject', 'magic-login' ); ?></span> |
| 344 |
<input |
| 345 |
name="registration_email_subject" |
| 346 |
id="registration_email_subject" |
| 347 |
class="sui-form-control" |
| 348 |
aria-labelledby="registration_email_subject_label" |
| 349 |
type="text" |
| 350 |
value="<?php echo esc_attr( $settings['registration']['email_subject'] ); ?>" |
| 351 |
/> |
| 352 |
</div> |
| 353 |
|
| 354 |
<div class="sui-form-field"> |
| 355 |
<span class="sui-settings-label" id="registration_email_label"><?php esc_html_e( 'Email Content', 'magic-login' ); ?></span> |
| 356 |
|
| 357 |
<?php |
| 358 |
wp_editor( |
| 359 |
$settings['registration']['email_content'], |
| 360 |
'registration_email_content', |
| 361 |
[ |
| 362 |
'textarea_name' => 'registration_email_content', |
| 363 |
'editor_css' => '', |
| 364 |
'editor_height' => 150, |
| 365 |
'drag_drop_upload' => false, |
| 366 |
'tinymce' => false, |
| 367 |
'teeny' => false, |
| 368 |
'media_buttons' => false, |
| 369 |
] |
| 370 |
); |
| 371 |
?> |
| 372 |
<span class="sui-description"><?php esc_html_e( 'Supported placeholders: {{SITEURL}}, {{USERNAME}}, {{FIRST_NAME}}, {{LAST_NAME}}, {{FULL_NAME}}, {{DISPLAY_NAME}}, {{USER_EMAIL}, {{SITENAME}}, {{EXPIRES}}, {{MAGIC_LINK}}, {{EXPIRES_WITH_INTERVAL}}, {{TOKEN_VALIDITY_COUNT}}', 'magic-login' ); ?></span> |
| 373 |
</div> |
| 374 |
</div> |
| 375 |
|
| 376 |
</div> |
| 377 |
|
| 378 |
<!-- Upsell ads --> |
| 379 |
<div class="sui-box-settings-row sui-upsell-row"> |
| 380 |
<div class="sui-upsell-notice" style="padding-left: 0;"> |
| 381 |
<p><?php esc_html_e( 'With our pro version of magic login, you will unlock the registration features of the plugin and get access to the WP-CLI command along with our premium support.' ); ?><br> |
| 382 |
<a href="https://handyplugins.co/magic-login-pro/?utm_source=wp_admin&utm_medium=plugin&utm_campaign=settings_page_registration" rel="noopener noreferrer nofollow" target="_blank" class="sui-button sui-button-purple" style="margin-top: 10px;color:#fff;"><?php esc_html_e( 'Try Magic Login Pro Today', 'magic-login' ); ?></a> |
| 383 |
</p> |
| 384 |
</div> |
| 385 |
</div> |
| 386 |
|
| 387 |
|
| 388 |
</div> |
| 389 |
|