| 1 |
<?php |
| 2 |
|
| 3 |
namespace King_Addons; |
| 4 |
|
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Group_Control_Border; |
| 7 |
use Elementor\Group_Control_Box_Shadow; |
| 8 |
use Elementor\Group_Control_Typography; |
| 9 |
use Elementor\Widget_Base; |
| 10 |
use Elementor\Utils; |
| 11 |
|
| 12 |
if (!defined('ABSPATH')) { |
| 13 |
exit; // Exit if accessed directly. |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Login Register Form Widget for King Addons |
| 18 |
* |
| 19 |
* @since 1.0.0 |
| 20 |
*/ |
| 21 |
class Login_Register_Form extends Widget_Base |
| 22 |
{ |
| 23 |
public function __construct($data = [], $args = null) |
| 24 |
{ |
| 25 |
parent::__construct($data, $args); |
| 26 |
} |
| 27 |
|
| 28 |
public function get_name() |
| 29 |
{ |
| 30 |
return 'king-addons-login-register-form'; |
| 31 |
} |
| 32 |
|
| 33 |
public function get_title() |
| 34 |
{ |
| 35 |
return esc_html__('Login | Register Form', 'king-addons'); |
| 36 |
} |
| 37 |
|
| 38 |
public function get_icon() |
| 39 |
{ |
| 40 |
return 'king-addons-icon king-addons-login-register-form'; |
| 41 |
} |
| 42 |
|
| 43 |
public function get_categories() |
| 44 |
{ |
| 45 |
return ['king-addons']; |
| 46 |
} |
| 47 |
|
| 48 |
public function get_keywords() |
| 49 |
{ |
| 50 |
return ['login', 'register', 'form', 'user', 'authentication', 'sign in', 'sign up', 'king addons']; |
| 51 |
} |
| 52 |
|
| 53 |
public function get_script_depends() |
| 54 |
{ |
| 55 |
return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-login-register-form-script']; |
| 56 |
} |
| 57 |
|
| 58 |
public function get_style_depends() |
| 59 |
{ |
| 60 |
return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-login-register-form-style']; |
| 61 |
} |
| 62 |
|
| 63 |
public function get_custom_help_url() |
| 64 |
{ |
| 65 |
return 'https://kingaddons.com/'; |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* Get user roles for select control |
| 70 |
*/ |
| 71 |
protected function get_user_roles() |
| 72 |
{ |
| 73 |
global $wp_roles; |
| 74 |
|
| 75 |
if (!isset($wp_roles)) { |
| 76 |
$wp_roles = new \WP_Roles(); |
| 77 |
} |
| 78 |
|
| 79 |
$roles = []; |
| 80 |
foreach ($wp_roles->roles as $role_key => $role) { |
| 81 |
$roles[$role_key] = $role['name']; |
| 82 |
} |
| 83 |
|
| 84 |
return $roles; |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Render form header with logo and illustration |
| 89 |
*/ |
| 90 |
protected function render_form_header($settings) |
| 91 |
{ |
| 92 |
if ($settings['show_form_header'] !== 'yes') { |
| 93 |
return; |
| 94 |
} |
| 95 |
|
| 96 |
$has_logo = !empty($settings['form_logo']['url']); |
| 97 |
$has_illustration = !empty($settings['form_illustration']['url']); |
| 98 |
|
| 99 |
if (!$has_logo && !$has_illustration) { |
| 100 |
return; |
| 101 |
} |
| 102 |
|
| 103 |
$illustration_position = $settings['form_illustration_position']; |
| 104 |
$wrapper_class = 'king-addons-form-header'; |
| 105 |
|
| 106 |
if ($has_illustration) { |
| 107 |
$wrapper_class .= ' king-addons-form-header-' . $illustration_position; |
| 108 |
} |
| 109 |
?> |
| 110 |
<div class="<?php echo esc_attr($wrapper_class); ?>"> |
| 111 |
<?php if ($has_illustration && in_array($illustration_position, ['left', 'top'])): ?> |
| 112 |
<div class="king-addons-form-illustration"> |
| 113 |
<img src="<?php echo esc_url($settings['form_illustration']['url']); ?>" |
| 114 |
alt="<?php echo esc_attr(get_post_meta($settings['form_illustration']['id'], '_wp_attachment_image_alt', true)); ?>"> |
| 115 |
</div> |
| 116 |
<?php endif; ?> |
| 117 |
|
| 118 |
<div class="king-addons-form-header-content"> |
| 119 |
<?php if ($has_logo): ?> |
| 120 |
<div class="king-addons-form-header-logo"> |
| 121 |
<img src="<?php echo esc_url($settings['form_logo']['url']); ?>" |
| 122 |
alt="<?php echo esc_attr(get_post_meta($settings['form_logo']['id'], '_wp_attachment_image_alt', true)); ?>"> |
| 123 |
</div> |
| 124 |
<?php endif; ?> |
| 125 |
</div> |
| 126 |
|
| 127 |
<?php if ($has_illustration && in_array($illustration_position, ['right', 'bottom'])): ?> |
| 128 |
<div class="king-addons-form-illustration"> |
| 129 |
<img src="<?php echo esc_url($settings['form_illustration']['url']); ?>" |
| 130 |
alt="<?php echo esc_attr(get_post_meta($settings['form_illustration']['id'], '_wp_attachment_image_alt', true)); ?>"> |
| 131 |
</div> |
| 132 |
<?php endif; ?> |
| 133 |
</div> |
| 134 |
<?php |
| 135 |
} |
| 136 |
|
| 137 |
/** |
| 138 |
* Render social login buttons |
| 139 |
*/ |
| 140 |
protected function render_social_login($settings, $context = 'login') |
| 141 |
{ |
| 142 |
// Only render social login for Pro users |
| 143 |
if (!king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 144 |
return; |
| 145 |
} |
| 146 |
|
| 147 |
if ($settings['enable_social_login'] !== 'yes') { |
| 148 |
return; |
| 149 |
} |
| 150 |
|
| 151 |
$show_google = $settings['enable_google_login'] === 'yes' && !empty($settings['google_client_id']); |
| 152 |
$show_facebook = $settings['enable_facebook_login'] === 'yes' && !empty($settings['facebook_app_id']); |
| 153 |
|
| 154 |
if (!$show_google && !$show_facebook) { |
| 155 |
return; |
| 156 |
} |
| 157 |
?> |
| 158 |
<div class="king-addons-social-login"> |
| 159 |
<?php if ($settings['social_login_separator'] === 'yes'): ?> |
| 160 |
<div class="king-addons-social-separator"> |
| 161 |
<span><?php echo esc_html($settings['social_login_heading'] ?? 'Or login with:'); ?></span> |
| 162 |
</div> |
| 163 |
<?php endif; ?> |
| 164 |
|
| 165 |
<div class="king-addons-social-buttons"> |
| 166 |
<?php if ($show_google): ?> |
| 167 |
<button type="button" class="king-addons-social-button king-addons-google-login" |
| 168 |
data-client-id="<?php echo esc_attr($settings['google_client_id']); ?>" |
| 169 |
data-context="<?php echo esc_attr($context); ?>"> |
| 170 |
<svg width="18" height="18" viewBox="0 0 24 24"> |
| 171 |
<path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/> |
| 172 |
<path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/> |
| 173 |
<path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/> |
| 174 |
<path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/> |
| 175 |
</svg> |
| 176 |
<?php echo esc_html__('Continue with Google', 'king-addons'); ?> |
| 177 |
</button> |
| 178 |
<?php endif; ?> |
| 179 |
|
| 180 |
<?php if ($show_facebook): ?> |
| 181 |
<button type="button" class="king-addons-social-button king-addons-facebook-login" |
| 182 |
data-app-id="<?php echo esc_attr($settings['facebook_app_id']); ?>" |
| 183 |
data-app-secret="<?php echo esc_attr($settings['facebook_app_secret']); ?>" |
| 184 |
data-context="<?php echo esc_attr($context); ?>"> |
| 185 |
<svg width="18" height="18" viewBox="0 0 24 24"> |
| 186 |
<path fill="#1877F2" d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/> |
| 187 |
</svg> |
| 188 |
<?php echo esc_html__('Continue with Facebook', 'king-addons'); ?> |
| 189 |
</button> |
| 190 |
<?php endif; ?> |
| 191 |
</div> |
| 192 |
</div> |
| 193 |
<?php |
| 194 |
} |
| 195 |
|
| 196 |
/** |
| 197 |
* Render custom fields |
| 198 |
*/ |
| 199 |
protected function render_custom_fields($settings, $show_labels = true) |
| 200 |
{ |
| 201 |
// Only render custom fields for Pro users |
| 202 |
if (!king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 203 |
return; |
| 204 |
} |
| 205 |
|
| 206 |
if (empty($settings['custom_fields'])) { |
| 207 |
return; |
| 208 |
} |
| 209 |
|
| 210 |
foreach ($settings['custom_fields'] as $index => $field) { |
| 211 |
$field_id = 'custom_field_' . $index; |
| 212 |
$field_name = 'custom_field_' . $index; |
| 213 |
$field_class = 'king-addons-form-field'; |
| 214 |
$field_label = !empty($field['field_label']) ? $field['field_label'] : 'Field ' . ($index + 1); |
| 215 |
|
| 216 |
if ($field['field_width'] === 'half') { |
| 217 |
$field_class .= ' king-addons-field-half'; |
| 218 |
} |
| 219 |
|
| 220 |
$required = $field['field_required'] === 'yes' ? 'required' : ''; |
| 221 |
?> |
| 222 |
<div class="<?php echo esc_attr($field_class); ?>" data-field-label="<?php echo esc_attr($field_label); ?>"> |
| 223 |
<?php if ($show_labels && !empty($field['field_label'])): ?> |
| 224 |
<label for="<?php echo esc_attr($field_id); ?>"> |
| 225 |
<?php echo esc_html($field['field_label']); ?> |
| 226 |
<?php if ($required): ?><span class="required">*</span><?php endif; ?> |
| 227 |
</label> |
| 228 |
<?php endif; ?> |
| 229 |
|
| 230 |
<?php |
| 231 |
switch ($field['field_type']) { |
| 232 |
case 'textarea': |
| 233 |
?> |
| 234 |
<textarea id="<?php echo esc_attr($field_id); ?>" |
| 235 |
name="<?php echo esc_attr($field_name); ?>" |
| 236 |
placeholder="<?php echo esc_attr($field['field_placeholder']); ?>" |
| 237 |
<?php echo $required; ?> |
| 238 |
rows="4"></textarea> |
| 239 |
<?php |
| 240 |
break; |
| 241 |
|
| 242 |
case 'select': |
| 243 |
?> |
| 244 |
<select id="<?php echo esc_attr($field_id); ?>" |
| 245 |
name="<?php echo esc_attr($field_name); ?>" |
| 246 |
<?php echo $required; ?>> |
| 247 |
<option value=""><?php echo esc_html__('Select an option', 'king-addons'); ?></option> |
| 248 |
<?php |
| 249 |
$options = explode("\n", $field['field_options']); |
| 250 |
foreach ($options as $option) { |
| 251 |
$option = trim($option); |
| 252 |
if (empty($option)) continue; |
| 253 |
|
| 254 |
$parts = explode('|', $option); |
| 255 |
$value = trim($parts[0]); |
| 256 |
$label = isset($parts[1]) ? trim($parts[1]) : $value; |
| 257 |
?> |
| 258 |
<option value="<?php echo esc_attr($value); ?>"><?php echo esc_html($label); ?></option> |
| 259 |
<?php |
| 260 |
} |
| 261 |
?> |
| 262 |
</select> |
| 263 |
<?php |
| 264 |
break; |
| 265 |
|
| 266 |
case 'file': |
| 267 |
?> |
| 268 |
<input type="file" |
| 269 |
id="<?php echo esc_attr($field_id); ?>" |
| 270 |
name="<?php echo esc_attr($field_name); ?>" |
| 271 |
<?php echo $required; ?>> |
| 272 |
<?php |
| 273 |
break; |
| 274 |
|
| 275 |
case 'checkbox': |
| 276 |
?> |
| 277 |
<div class="king-addons-checkbox-group"> |
| 278 |
<?php |
| 279 |
$options = explode("\n", $field['field_options']); |
| 280 |
foreach ($options as $option_index => $option) { |
| 281 |
$option = trim($option); |
| 282 |
if (empty($option)) continue; |
| 283 |
|
| 284 |
$parts = explode('|', $option); |
| 285 |
$value = trim($parts[0]); |
| 286 |
$label = isset($parts[1]) ? trim($parts[1]) : $value; |
| 287 |
$option_id = $field_id . '_' . $option_index; |
| 288 |
?> |
| 289 |
<div class="king-addons-checkbox-option"> |
| 290 |
<input type="checkbox" |
| 291 |
id="<?php echo esc_attr($option_id); ?>" |
| 292 |
name="<?php echo esc_attr($field_name); ?>" |
| 293 |
value="<?php echo esc_attr($value); ?>" |
| 294 |
<?php echo $required; ?>> |
| 295 |
<label for="<?php echo esc_attr($option_id); ?>"><?php echo esc_html($label); ?></label> |
| 296 |
</div> |
| 297 |
<?php |
| 298 |
} |
| 299 |
?> |
| 300 |
</div> |
| 301 |
<?php |
| 302 |
break; |
| 303 |
|
| 304 |
case 'radio': |
| 305 |
?> |
| 306 |
<div class="king-addons-radio-group"> |
| 307 |
<?php |
| 308 |
$options = explode("\n", $field['field_options']); |
| 309 |
foreach ($options as $option_index => $option) { |
| 310 |
$option = trim($option); |
| 311 |
if (empty($option)) continue; |
| 312 |
|
| 313 |
$parts = explode('|', $option); |
| 314 |
$value = trim($parts[0]); |
| 315 |
$label = isset($parts[1]) ? trim($parts[1]) : $value; |
| 316 |
$option_id = $field_id . '_' . $option_index; |
| 317 |
?> |
| 318 |
<div class="king-addons-radio-option"> |
| 319 |
<input type="radio" |
| 320 |
id="<?php echo esc_attr($option_id); ?>" |
| 321 |
name="<?php echo esc_attr($field_name); ?>" |
| 322 |
value="<?php echo esc_attr($value); ?>" |
| 323 |
<?php echo $required; ?>> |
| 324 |
<label for="<?php echo esc_attr($option_id); ?>"><?php echo esc_html($label); ?></label> |
| 325 |
</div> |
| 326 |
<?php |
| 327 |
} |
| 328 |
?> |
| 329 |
</div> |
| 330 |
<?php |
| 331 |
break; |
| 332 |
|
| 333 |
default: |
| 334 |
?> |
| 335 |
<input type="<?php echo esc_attr($field['field_type']); ?>" |
| 336 |
id="<?php echo esc_attr($field_id); ?>" |
| 337 |
name="<?php echo esc_attr($field_name); ?>" |
| 338 |
placeholder="<?php echo esc_attr($field['field_placeholder']); ?>" |
| 339 |
<?php echo $required; ?>> |
| 340 |
<?php |
| 341 |
break; |
| 342 |
} |
| 343 |
?> |
| 344 |
</div> |
| 345 |
<?php |
| 346 |
} |
| 347 |
} |
| 348 |
|
| 349 |
/** |
| 350 |
* Render reCAPTCHA element |
| 351 |
*/ |
| 352 |
protected function render_recaptcha($settings, $form_type) |
| 353 |
{ |
| 354 |
if ($settings['enable_recaptcha'] !== 'yes' || empty($settings['recaptcha_site_key'])) { |
| 355 |
return; |
| 356 |
} |
| 357 |
|
| 358 |
if (!in_array($form_type, $settings['recaptcha_apply_on'])) { |
| 359 |
return; |
| 360 |
} |
| 361 |
|
| 362 |
$widget_id = $this->get_id(); |
| 363 |
$recaptcha_id = 'recaptcha-' . $form_type . '-' . $widget_id; |
| 364 |
|
| 365 |
if ($settings['recaptcha_version'] === 'v2') { |
| 366 |
?> |
| 367 |
<div class="king-addons-recaptcha-field"> |
| 368 |
<div id="<?php echo esc_attr($recaptcha_id); ?>" |
| 369 |
class="king-addons-recaptcha-v2" |
| 370 |
data-sitekey="<?php echo esc_attr($settings['recaptcha_site_key']); ?>" |
| 371 |
data-theme="<?php echo esc_attr($settings['recaptcha_theme']); ?>" |
| 372 |
data-size="<?php echo esc_attr($settings['recaptcha_size']); ?>"> |
| 373 |
</div> |
| 374 |
</div> |
| 375 |
<?php |
| 376 |
} else { |
| 377 |
// reCAPTCHA v3 is handled via JavaScript |
| 378 |
?> |
| 379 |
<input type="hidden" |
| 380 |
name="g-recaptcha-response" |
| 381 |
class="king-addons-recaptcha-v3" |
| 382 |
data-sitekey="<?php echo esc_attr($settings['recaptcha_site_key']); ?>" |
| 383 |
data-action="<?php echo esc_attr($form_type); ?>" |
| 384 |
data-threshold="<?php echo esc_attr($settings['recaptcha_score_threshold']['size']); ?>"> |
| 385 |
<?php |
| 386 |
} |
| 387 |
} |
| 388 |
|
| 389 |
protected function register_controls() |
| 390 |
{ |
| 391 |
// General Settings |
| 392 |
$this->start_controls_section( |
| 393 |
'section_general', |
| 394 |
[ |
| 395 |
'label' => esc_html__('General', 'king-addons'), |
| 396 |
] |
| 397 |
); |
| 398 |
|
| 399 |
$this->add_control( |
| 400 |
'default_form_type', |
| 401 |
[ |
| 402 |
'label' => esc_html__('Default Form Type', 'king-addons'), |
| 403 |
'type' => Controls_Manager::SELECT, |
| 404 |
'options' => [ |
| 405 |
'login' => esc_html__('Login', 'king-addons'), |
| 406 |
'register' => esc_html__('Register', 'king-addons'), |
| 407 |
], |
| 408 |
'default' => 'login', |
| 409 |
] |
| 410 |
); |
| 411 |
|
| 412 |
$this->add_control( |
| 413 |
'show_labels', |
| 414 |
[ |
| 415 |
'label' => esc_html__('Show Labels', 'king-addons'), |
| 416 |
'type' => Controls_Manager::SWITCHER, |
| 417 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 418 |
'label_off' => esc_html__('No', 'king-addons'), |
| 419 |
'return_value' => 'yes', |
| 420 |
'default' => 'yes', |
| 421 |
] |
| 422 |
); |
| 423 |
|
| 424 |
$this->add_control( |
| 425 |
'enable_ajax', |
| 426 |
[ |
| 427 |
'label' => esc_html__('Enable AJAX', 'king-addons'), |
| 428 |
'type' => Controls_Manager::SWITCHER, |
| 429 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 430 |
'label_off' => esc_html__('No', 'king-addons'), |
| 431 |
'return_value' => 'yes', |
| 432 |
'default' => 'yes', |
| 433 |
] |
| 434 |
); |
| 435 |
|
| 436 |
$this->end_controls_section(); |
| 437 |
|
| 438 |
// Form Header Section |
| 439 |
$this->start_controls_section( |
| 440 |
'section_form_header', |
| 441 |
[ |
| 442 |
'label' => esc_html__('Form Header', 'king-addons'), |
| 443 |
] |
| 444 |
); |
| 445 |
|
| 446 |
$this->add_control( |
| 447 |
'show_form_header', |
| 448 |
[ |
| 449 |
'label' => esc_html__('Show Form Header', 'king-addons'), |
| 450 |
'type' => Controls_Manager::SWITCHER, |
| 451 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 452 |
'label_off' => esc_html__('No', 'king-addons'), |
| 453 |
'return_value' => 'yes', |
| 454 |
'default' => '', |
| 455 |
] |
| 456 |
); |
| 457 |
|
| 458 |
$this->add_control( |
| 459 |
'form_logo', |
| 460 |
[ |
| 461 |
'label' => esc_html__('Logo', 'king-addons'), |
| 462 |
'type' => Controls_Manager::MEDIA, |
| 463 |
'condition' => [ |
| 464 |
'show_form_header' => 'yes', |
| 465 |
], |
| 466 |
] |
| 467 |
); |
| 468 |
|
| 469 |
$this->add_responsive_control( |
| 470 |
'form_logo_width', |
| 471 |
[ |
| 472 |
'label' => esc_html__('Logo Width', 'king-addons'), |
| 473 |
'type' => Controls_Manager::SLIDER, |
| 474 |
'size_units' => ['px', '%'], |
| 475 |
'range' => [ |
| 476 |
'px' => [ |
| 477 |
'min' => 0, |
| 478 |
'max' => 500, |
| 479 |
], |
| 480 |
'%' => [ |
| 481 |
'min' => 0, |
| 482 |
'max' => 100, |
| 483 |
], |
| 484 |
], |
| 485 |
'default' => [ |
| 486 |
'unit' => 'px', |
| 487 |
'size' => 150, |
| 488 |
], |
| 489 |
'condition' => [ |
| 490 |
'show_form_header' => 'yes', |
| 491 |
'form_logo[url]!' => '', |
| 492 |
], |
| 493 |
'selectors' => [ |
| 494 |
'{{WRAPPER}} .king-addons-form-header-logo img' => 'width: {{SIZE}}{{UNIT}};', |
| 495 |
], |
| 496 |
] |
| 497 |
); |
| 498 |
|
| 499 |
$this->add_control( |
| 500 |
'form_illustration', |
| 501 |
[ |
| 502 |
'label' => esc_html__('Illustration', 'king-addons'), |
| 503 |
'type' => Controls_Manager::MEDIA, |
| 504 |
'condition' => [ |
| 505 |
'show_form_header' => 'yes', |
| 506 |
], |
| 507 |
] |
| 508 |
); |
| 509 |
|
| 510 |
$this->add_control( |
| 511 |
'form_illustration_position', |
| 512 |
[ |
| 513 |
'label' => esc_html__('Illustration Position', 'king-addons'), |
| 514 |
'type' => Controls_Manager::SELECT, |
| 515 |
'options' => [ |
| 516 |
'left' => esc_html__('Left', 'king-addons'), |
| 517 |
'right' => esc_html__('Right', 'king-addons'), |
| 518 |
'top' => esc_html__('Top', 'king-addons'), |
| 519 |
'bottom' => esc_html__('Bottom', 'king-addons'), |
| 520 |
], |
| 521 |
'default' => 'left', |
| 522 |
'condition' => [ |
| 523 |
'show_form_header' => 'yes', |
| 524 |
'form_illustration[url]!' => '', |
| 525 |
], |
| 526 |
] |
| 527 |
); |
| 528 |
|
| 529 |
$this->add_responsive_control( |
| 530 |
'form_illustration_width', |
| 531 |
[ |
| 532 |
'label' => esc_html__('Illustration Width', 'king-addons'), |
| 533 |
'type' => Controls_Manager::SLIDER, |
| 534 |
'size_units' => ['px', '%'], |
| 535 |
'range' => [ |
| 536 |
'px' => [ |
| 537 |
'min' => 0, |
| 538 |
'max' => 800, |
| 539 |
], |
| 540 |
'%' => [ |
| 541 |
'min' => 0, |
| 542 |
'max' => 100, |
| 543 |
], |
| 544 |
], |
| 545 |
'default' => [ |
| 546 |
'unit' => '%', |
| 547 |
'size' => 50, |
| 548 |
], |
| 549 |
'condition' => [ |
| 550 |
'show_form_header' => 'yes', |
| 551 |
'form_illustration[url]!' => '', |
| 552 |
], |
| 553 |
'selectors' => [ |
| 554 |
'{{WRAPPER}} .king-addons-form-illustration' => 'width: {{SIZE}}{{UNIT}};', |
| 555 |
], |
| 556 |
] |
| 557 |
); |
| 558 |
|
| 559 |
$this->end_controls_section(); |
| 560 |
|
| 561 |
// Login Form Section |
| 562 |
$this->start_controls_section( |
| 563 |
'section_login_form', |
| 564 |
[ |
| 565 |
'label' => esc_html__('Login Form', 'king-addons'), |
| 566 |
] |
| 567 |
); |
| 568 |
|
| 569 |
$this->add_control( |
| 570 |
'login_form_title', |
| 571 |
[ |
| 572 |
'label' => esc_html__('Form Title', 'king-addons'), |
| 573 |
'type' => Controls_Manager::TEXT, |
| 574 |
'default' => esc_html__('Login to Your Account', 'king-addons'), |
| 575 |
'placeholder' => esc_html__('Enter title', 'king-addons'), |
| 576 |
'dynamic' => ['active' => true], |
| 577 |
'ai' => ['active' => false], |
| 578 |
] |
| 579 |
); |
| 580 |
|
| 581 |
$this->add_control( |
| 582 |
'login_form_subtitle', |
| 583 |
[ |
| 584 |
'label' => esc_html__('Form Subtitle', 'king-addons'), |
| 585 |
'type' => Controls_Manager::TEXTAREA, |
| 586 |
'default' => esc_html__('Please enter your username and password to log in.', 'king-addons'), |
| 587 |
'placeholder' => esc_html__('Enter subtitle', 'king-addons'), |
| 588 |
'dynamic' => ['active' => true], |
| 589 |
] |
| 590 |
); |
| 591 |
|
| 592 |
$this->add_control( |
| 593 |
'login_username_label', |
| 594 |
[ |
| 595 |
'label' => esc_html__('Username/Email Label', 'king-addons'), |
| 596 |
'type' => Controls_Manager::TEXT, |
| 597 |
'default' => esc_html__('Username or Email', 'king-addons'), |
| 598 |
'dynamic' => ['active' => true], |
| 599 |
'ai' => ['active' => false], |
| 600 |
] |
| 601 |
); |
| 602 |
|
| 603 |
$this->add_control( |
| 604 |
'login_username_placeholder', |
| 605 |
[ |
| 606 |
'label' => esc_html__('Username/Email Placeholder', 'king-addons'), |
| 607 |
'type' => Controls_Manager::TEXT, |
| 608 |
'default' => esc_html__('Enter your username or email', 'king-addons'), |
| 609 |
'dynamic' => ['active' => true], |
| 610 |
'ai' => ['active' => false], |
| 611 |
] |
| 612 |
); |
| 613 |
|
| 614 |
$this->add_control( |
| 615 |
'login_password_label', |
| 616 |
[ |
| 617 |
'label' => esc_html__('Password Label', 'king-addons'), |
| 618 |
'type' => Controls_Manager::TEXT, |
| 619 |
'default' => esc_html__('Password', 'king-addons'), |
| 620 |
'dynamic' => ['active' => true], |
| 621 |
'ai' => ['active' => false], |
| 622 |
] |
| 623 |
); |
| 624 |
|
| 625 |
$this->add_control( |
| 626 |
'login_password_placeholder', |
| 627 |
[ |
| 628 |
'label' => esc_html__('Password Placeholder', 'king-addons'), |
| 629 |
'type' => Controls_Manager::TEXT, |
| 630 |
'default' => esc_html__('Enter your password', 'king-addons'), |
| 631 |
'dynamic' => ['active' => true], |
| 632 |
'ai' => ['active' => false], |
| 633 |
] |
| 634 |
); |
| 635 |
|
| 636 |
$this->add_control( |
| 637 |
'login_button_text', |
| 638 |
[ |
| 639 |
'label' => esc_html__('Login Button Text', 'king-addons'), |
| 640 |
'type' => Controls_Manager::TEXT, |
| 641 |
'default' => esc_html__('Login', 'king-addons'), |
| 642 |
'dynamic' => ['active' => true], |
| 643 |
'ai' => ['active' => false], |
| 644 |
] |
| 645 |
); |
| 646 |
|
| 647 |
$this->add_control( |
| 648 |
'show_password_visibility_login', |
| 649 |
[ |
| 650 |
'label' => esc_html__('Show Password Visibility Toggle', 'king-addons'), |
| 651 |
'type' => Controls_Manager::SWITCHER, |
| 652 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 653 |
'label_off' => esc_html__('No', 'king-addons'), |
| 654 |
'return_value' => 'yes', |
| 655 |
'default' => 'yes', |
| 656 |
] |
| 657 |
); |
| 658 |
|
| 659 |
$this->add_control( |
| 660 |
'show_remember_me', |
| 661 |
[ |
| 662 |
'label' => esc_html__('Show Remember Me', 'king-addons'), |
| 663 |
'type' => Controls_Manager::SWITCHER, |
| 664 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 665 |
'label_off' => esc_html__('No', 'king-addons'), |
| 666 |
'return_value' => 'yes', |
| 667 |
'default' => 'yes', |
| 668 |
] |
| 669 |
); |
| 670 |
|
| 671 |
$this->add_control( |
| 672 |
'remember_me_text', |
| 673 |
[ |
| 674 |
'label' => esc_html__('Remember Me Text', 'king-addons'), |
| 675 |
'type' => Controls_Manager::TEXT, |
| 676 |
'default' => esc_html__('Remember Me', 'king-addons'), |
| 677 |
'condition' => [ |
| 678 |
'show_remember_me' => 'yes', |
| 679 |
], |
| 680 |
'dynamic' => ['active' => true], |
| 681 |
'ai' => ['active' => false], |
| 682 |
] |
| 683 |
); |
| 684 |
|
| 685 |
$this->add_control( |
| 686 |
'show_lost_password', |
| 687 |
[ |
| 688 |
'label' => esc_html__('Show Lost Password Link', 'king-addons'), |
| 689 |
'type' => Controls_Manager::SWITCHER, |
| 690 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 691 |
'label_off' => esc_html__('No', 'king-addons'), |
| 692 |
'return_value' => 'yes', |
| 693 |
'default' => 'yes', |
| 694 |
] |
| 695 |
); |
| 696 |
|
| 697 |
$this->add_control( |
| 698 |
'lost_password_text', |
| 699 |
[ |
| 700 |
'label' => esc_html__('Lost Password Text', 'king-addons'), |
| 701 |
'type' => Controls_Manager::TEXT, |
| 702 |
'default' => esc_html__('Forgot Password?', 'king-addons'), |
| 703 |
'condition' => [ |
| 704 |
'show_lost_password' => 'yes', |
| 705 |
], |
| 706 |
'dynamic' => ['active' => true], |
| 707 |
'ai' => ['active' => false], |
| 708 |
] |
| 709 |
); |
| 710 |
|
| 711 |
$this->add_control( |
| 712 |
'show_register_link', |
| 713 |
[ |
| 714 |
'label' => esc_html__('Show Register Link', 'king-addons'), |
| 715 |
'type' => Controls_Manager::SWITCHER, |
| 716 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 717 |
'label_off' => esc_html__('No', 'king-addons'), |
| 718 |
'return_value' => 'yes', |
| 719 |
'default' => 'yes', |
| 720 |
] |
| 721 |
); |
| 722 |
|
| 723 |
$this->add_control( |
| 724 |
'register_link_text', |
| 725 |
[ |
| 726 |
'label' => esc_html__('Register Link Text', 'king-addons'), |
| 727 |
'type' => Controls_Manager::TEXT, |
| 728 |
'default' => esc_html__("Don't have an account? Register", 'king-addons'), |
| 729 |
'condition' => [ |
| 730 |
'show_register_link' => 'yes', |
| 731 |
], |
| 732 |
'dynamic' => ['active' => true], |
| 733 |
'ai' => ['active' => false], |
| 734 |
] |
| 735 |
); |
| 736 |
|
| 737 |
$this->add_control( |
| 738 |
'show_lost_password_link', |
| 739 |
[ |
| 740 |
'label' => esc_html__('Show Lost Password Link', 'king-addons'), |
| 741 |
'type' => Controls_Manager::SWITCHER, |
| 742 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 743 |
'label_off' => esc_html__('No', 'king-addons'), |
| 744 |
'return_value' => 'yes', |
| 745 |
'default' => 'yes', |
| 746 |
] |
| 747 |
); |
| 748 |
|
| 749 |
$this->add_control( |
| 750 |
'lost_password_link_text', |
| 751 |
[ |
| 752 |
'label' => esc_html__('Lost Password Link Text', 'king-addons'), |
| 753 |
'type' => Controls_Manager::TEXT, |
| 754 |
'default' => esc_html__('Forgot your password?', 'king-addons'), |
| 755 |
'condition' => [ |
| 756 |
'show_lost_password_link' => 'yes', |
| 757 |
], |
| 758 |
'dynamic' => ['active' => true], |
| 759 |
'ai' => ['active' => false], |
| 760 |
] |
| 761 |
); |
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
$this->end_controls_section(); |
| 766 |
|
| 767 |
// Email Notifications Section |
| 768 |
$this->start_controls_section( |
| 769 |
'section_email_notifications', |
| 770 |
[ |
| 771 |
'label' => esc_html__('Email Notifications', 'king-addons'), |
| 772 |
] |
| 773 |
); |
| 774 |
|
| 775 |
$this->add_control( |
| 776 |
'enable_user_email', |
| 777 |
[ |
| 778 |
'label' => esc_html__('Send Email to User', 'king-addons'), |
| 779 |
'type' => Controls_Manager::SWITCHER, |
| 780 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 781 |
'label_off' => esc_html__('No', 'king-addons'), |
| 782 |
'return_value' => 'yes', |
| 783 |
'default' => 'yes', |
| 784 |
'description' => esc_html__('Send a welcome email to the user after successful registration.', 'king-addons'), |
| 785 |
] |
| 786 |
); |
| 787 |
|
| 788 |
$this->add_control( |
| 789 |
'user_email_subject', |
| 790 |
[ |
| 791 |
'label' => esc_html__('User Email Subject', 'king-addons'), |
| 792 |
'type' => Controls_Manager::TEXT, |
| 793 |
'default' => esc_html__('Welcome to {site_name}!', 'king-addons'), |
| 794 |
'condition' => [ |
| 795 |
'enable_user_email' => 'yes', |
| 796 |
], |
| 797 |
'dynamic' => ['active' => true], |
| 798 |
'ai' => ['active' => false], |
| 799 |
] |
| 800 |
); |
| 801 |
|
| 802 |
if (!king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 803 |
\King_Addons\Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'login-register-form', 'user_email_subject', ['']); |
| 804 |
} |
| 805 |
|
| 806 |
$this->add_control( |
| 807 |
'user_email_content', |
| 808 |
[ |
| 809 |
'label' => esc_html__('User Email Content', 'king-addons'), |
| 810 |
'type' => Controls_Manager::TEXTAREA, |
| 811 |
'rows' => 10, |
| 812 |
'default' => "Hello {user_name},\n\nWelcome to {site_name}!\n\nYour account has been successfully created.\n\nUsername: {username}\nEmail: {user_email}\n\nThank you for joining us!\n\nBest regards,\n{site_name} Team", |
| 813 |
'condition' => [ |
| 814 |
'enable_user_email' => 'yes', |
| 815 |
], |
| 816 |
'dynamic' => ['active' => true], |
| 817 |
'ai' => ['active' => false], |
| 818 |
] |
| 819 |
); |
| 820 |
|
| 821 |
if (!king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 822 |
\King_Addons\Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'login-register-form', 'user_email_content', ['']); |
| 823 |
} |
| 824 |
|
| 825 |
$this->add_control( |
| 826 |
'enable_admin_email', |
| 827 |
[ |
| 828 |
'label' => sprintf(__('Send Email to Admin %s', 'king-addons'), '<i class="eicon-pro-icon"></i>'), |
| 829 |
'type' => Controls_Manager::SWITCHER, |
| 830 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 831 |
'label_off' => esc_html__('No', 'king-addons'), |
| 832 |
'return_value' => 'yes', |
| 833 |
'default' => '', |
| 834 |
'description' => esc_html__('Send a notification email to the admin when a user registers.', 'king-addons'), |
| 835 |
'classes' => 'king-addons-pro-control', |
| 836 |
] |
| 837 |
); |
| 838 |
|
| 839 |
if (!king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 840 |
\King_Addons\Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'login-register-form', 'enable_admin_email', ['yes']); |
| 841 |
} else { |
| 842 |
$this->add_control( |
| 843 |
'admin_email_address', |
| 844 |
[ |
| 845 |
'label' => esc_html__('Admin Email Address', 'king-addons'), |
| 846 |
'type' => Controls_Manager::TEXT, |
| 847 |
'default' => get_option('admin_email'), |
| 848 |
'condition' => [ |
| 849 |
'enable_admin_email' => 'yes', |
| 850 |
], |
| 851 |
'dynamic' => ['active' => true], |
| 852 |
'ai' => ['active' => false], |
| 853 |
] |
| 854 |
); |
| 855 |
|
| 856 |
$this->add_control( |
| 857 |
'admin_email_subject', |
| 858 |
[ |
| 859 |
'label' => esc_html__('Admin Email Subject', 'king-addons'), |
| 860 |
'type' => Controls_Manager::TEXT, |
| 861 |
'default' => esc_html__('New User Registration on {site_name}', 'king-addons'), |
| 862 |
'condition' => [ |
| 863 |
'enable_admin_email' => 'yes', |
| 864 |
], |
| 865 |
'dynamic' => ['active' => true], |
| 866 |
'ai' => ['active' => false], |
| 867 |
] |
| 868 |
); |
| 869 |
|
| 870 |
$this->add_control( |
| 871 |
'admin_email_content', |
| 872 |
[ |
| 873 |
'label' => esc_html__('Admin Email Content', 'king-addons'), |
| 874 |
'type' => Controls_Manager::TEXTAREA, |
| 875 |
'rows' => 10, |
| 876 |
'default' => "Hello Admin,\n\nA new user has registered on {site_name}.\n\nUser Details:\nName: {user_name}\nUsername: {username}\nEmail: {user_email}\nRole: {user_role}\nRegistration Date: {registration_date}\n\nYou can view the user profile in the admin dashboard.\n\nBest regards,\n{site_name}", |
| 877 |
'condition' => [ |
| 878 |
'enable_admin_email' => 'yes', |
| 879 |
], |
| 880 |
'dynamic' => ['active' => true], |
| 881 |
'ai' => ['active' => false], |
| 882 |
] |
| 883 |
); |
| 884 |
} |
| 885 |
|
| 886 |
$this->add_control( |
| 887 |
'email_placeholders_info', |
| 888 |
[ |
| 889 |
'type' => Controls_Manager::RAW_HTML, |
| 890 |
'raw' => esc_html__('Available placeholders: {site_name}, {user_name}, {username}, {user_email}, {user_role}, {registration_date}', 'king-addons'), |
| 891 |
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 892 |
] |
| 893 |
); |
| 894 |
|
| 895 |
$this->end_controls_section(); |
| 896 |
|
| 897 |
// Mailchimp Integration Section |
| 898 |
$this->start_controls_section( |
| 899 |
'section_mailchimp_integration', |
| 900 |
[ |
| 901 |
'label' => esc_html__('Mailchimp Integration', 'king-addons'), |
| 902 |
] |
| 903 |
); |
| 904 |
|
| 905 |
$this->add_control( |
| 906 |
'enable_mailchimp_integration', |
| 907 |
[ |
| 908 |
'label' => sprintf(__('Enable Mailchimp Integration %s', 'king-addons'), '<i class="eicon-pro-icon"></i>'), |
| 909 |
'type' => Controls_Manager::SWITCHER, |
| 910 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 911 |
'label_off' => esc_html__('No', 'king-addons'), |
| 912 |
'return_value' => 'yes', |
| 913 |
'default' => '', |
| 914 |
'description' => esc_html__('Automatically subscribe users to your Mailchimp list upon registration.', 'king-addons'), |
| 915 |
'classes' => 'king-addons-pro-control', |
| 916 |
] |
| 917 |
); |
| 918 |
|
| 919 |
if (!king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 920 |
\King_Addons\Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'login-register-form', 'enable_mailchimp_integration', ['yes']); |
| 921 |
} else { |
| 922 |
$this->add_control( |
| 923 |
'mailchimp_api_key', |
| 924 |
[ |
| 925 |
'label' => esc_html__('Mailchimp API Key', 'king-addons'), |
| 926 |
'type' => Controls_Manager::TEXT, |
| 927 |
'placeholder' => esc_html__('Enter your Mailchimp API Key', 'king-addons'), |
| 928 |
'condition' => [ |
| 929 |
'enable_mailchimp_integration' => 'yes', |
| 930 |
], |
| 931 |
'dynamic' => ['active' => true], |
| 932 |
'ai' => ['active' => false], |
| 933 |
] |
| 934 |
); |
| 935 |
|
| 936 |
$this->add_control( |
| 937 |
'mailchimp_list_id', |
| 938 |
[ |
| 939 |
'label' => esc_html__('Mailchimp List ID', 'king-addons'), |
| 940 |
'type' => Controls_Manager::TEXT, |
| 941 |
'placeholder' => esc_html__('Enter your Mailchimp List ID', 'king-addons'), |
| 942 |
'condition' => [ |
| 943 |
'enable_mailchimp_integration' => 'yes', |
| 944 |
], |
| 945 |
'dynamic' => ['active' => true], |
| 946 |
'ai' => ['active' => false], |
| 947 |
] |
| 948 |
); |
| 949 |
|
| 950 |
$this->add_control( |
| 951 |
'mailchimp_double_optin', |
| 952 |
[ |
| 953 |
'label' => esc_html__('Double Opt-in', 'king-addons'), |
| 954 |
'type' => Controls_Manager::SWITCHER, |
| 955 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 956 |
'label_off' => esc_html__('No', 'king-addons'), |
| 957 |
'return_value' => 'yes', |
| 958 |
'default' => '', |
| 959 |
'description' => esc_html__('Send confirmation email to subscribers.', 'king-addons'), |
| 960 |
'condition' => [ |
| 961 |
'enable_mailchimp_integration' => 'yes', |
| 962 |
], |
| 963 |
] |
| 964 |
); |
| 965 |
|
| 966 |
$this->add_control( |
| 967 |
'mailchimp_setup_info', |
| 968 |
[ |
| 969 |
'type' => Controls_Manager::RAW_HTML, |
| 970 |
'raw' => sprintf( |
| 971 |
esc_html__('To get your API key and List ID, go to your %s and navigate to Account > Extras > API keys and Audience > Manage Audience > Settings > Audience name and defaults.', 'king-addons'), |
| 972 |
'<a href="https://mailchimp.com/" target="_blank">Mailchimp account</a>' |
| 973 |
), |
| 974 |
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 975 |
'condition' => [ |
| 976 |
'enable_mailchimp_integration' => 'yes', |
| 977 |
], |
| 978 |
] |
| 979 |
); |
| 980 |
} |
| 981 |
|
| 982 |
$this->end_controls_section(); |
| 983 |
|
| 984 |
// Register Actions Section |
| 985 |
$this->start_controls_section( |
| 986 |
'section_register_actions', |
| 987 |
[ |
| 988 |
'label' => esc_html__('Register Actions', 'king-addons'), |
| 989 |
] |
| 990 |
); |
| 991 |
|
| 992 |
$this->add_control( |
| 993 |
'auto_login_after_register', |
| 994 |
[ |
| 995 |
'label' => esc_html__('Auto Login After Registration', 'king-addons'), |
| 996 |
'type' => Controls_Manager::SWITCHER, |
| 997 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 998 |
'label_off' => esc_html__('No', 'king-addons'), |
| 999 |
'return_value' => 'yes', |
| 1000 |
'default' => 'yes', |
| 1001 |
'description' => esc_html__('Automatically log in the user after successful registration.', 'king-addons'), |
| 1002 |
] |
| 1003 |
); |
| 1004 |
|
| 1005 |
$this->add_control( |
| 1006 |
'redirect_after_register', |
| 1007 |
[ |
| 1008 |
'label' => esc_html__('Redirect After Registration', 'king-addons'), |
| 1009 |
'type' => Controls_Manager::URL, |
| 1010 |
'placeholder' => esc_html__('https://yoursite.com/welcome', 'king-addons'), |
| 1011 |
'dynamic' => ['active' => true], |
| 1012 |
'description' => esc_html__('Leave empty to stay on the current page.', 'king-addons'), |
| 1013 |
] |
| 1014 |
); |
| 1015 |
|
| 1016 |
$this->add_control( |
| 1017 |
'redirect_after_login', |
| 1018 |
[ |
| 1019 |
'label' => esc_html__('Redirect After Login', 'king-addons'), |
| 1020 |
'type' => Controls_Manager::URL, |
| 1021 |
'placeholder' => esc_html__('https://yoursite.com/dashboard', 'king-addons'), |
| 1022 |
'dynamic' => ['active' => true], |
| 1023 |
'description' => esc_html__('Leave empty to stay on the current page.', 'king-addons'), |
| 1024 |
] |
| 1025 |
); |
| 1026 |
|
| 1027 |
$this->add_control( |
| 1028 |
'redirect_logout_user', |
| 1029 |
[ |
| 1030 |
'label' => esc_html__('Redirect Already Logged Users', 'king-addons'), |
| 1031 |
'type' => Controls_Manager::SWITCHER, |
| 1032 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1033 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1034 |
'return_value' => 'yes', |
| 1035 |
'default' => '', |
| 1036 |
'description' => esc_html__('Redirect users who are already logged in.', 'king-addons'), |
| 1037 |
] |
| 1038 |
); |
| 1039 |
|
| 1040 |
$this->add_control( |
| 1041 |
'redirect_logout_url', |
| 1042 |
[ |
| 1043 |
'label' => esc_html__('Redirect URL for Logged Users', 'king-addons'), |
| 1044 |
'type' => Controls_Manager::URL, |
| 1045 |
'placeholder' => esc_html__('https://yoursite.com/dashboard', 'king-addons'), |
| 1046 |
'condition' => [ |
| 1047 |
'redirect_logout_user' => 'yes', |
| 1048 |
], |
| 1049 |
'dynamic' => ['active' => true], |
| 1050 |
] |
| 1051 |
); |
| 1052 |
|
| 1053 |
$this->end_controls_section(); |
| 1054 |
|
| 1055 |
// Lost Password Form Section |
| 1056 |
$this->start_controls_section( |
| 1057 |
'section_lost_password_form', |
| 1058 |
[ |
| 1059 |
'label' => esc_html__('Lost Password Form', 'king-addons'), |
| 1060 |
'condition' => [ |
| 1061 |
'show_lost_password_link' => 'yes', |
| 1062 |
], |
| 1063 |
] |
| 1064 |
); |
| 1065 |
|
| 1066 |
$this->add_control( |
| 1067 |
'lostpassword_form_title', |
| 1068 |
[ |
| 1069 |
'label' => esc_html__('Form Title', 'king-addons'), |
| 1070 |
'type' => Controls_Manager::TEXT, |
| 1071 |
'default' => esc_html__('Lost Your Password?', 'king-addons'), |
| 1072 |
'dynamic' => ['active' => true], |
| 1073 |
'ai' => ['active' => false], |
| 1074 |
] |
| 1075 |
); |
| 1076 |
|
| 1077 |
$this->add_control( |
| 1078 |
'lostpassword_form_subtitle', |
| 1079 |
[ |
| 1080 |
'label' => esc_html__('Form Subtitle', 'king-addons'), |
| 1081 |
'type' => Controls_Manager::TEXTAREA, |
| 1082 |
'default' => esc_html__('Enter your email address and we will send you a link to reset your password.', 'king-addons'), |
| 1083 |
'dynamic' => ['active' => true], |
| 1084 |
'ai' => ['active' => false], |
| 1085 |
] |
| 1086 |
); |
| 1087 |
|
| 1088 |
$this->add_control( |
| 1089 |
'lostpassword_email_label', |
| 1090 |
[ |
| 1091 |
'label' => esc_html__('Email Label', 'king-addons'), |
| 1092 |
'type' => Controls_Manager::TEXT, |
| 1093 |
'default' => esc_html__('Email', 'king-addons'), |
| 1094 |
'dynamic' => ['active' => true], |
| 1095 |
'ai' => ['active' => false], |
| 1096 |
] |
| 1097 |
); |
| 1098 |
|
| 1099 |
$this->add_control( |
| 1100 |
'lostpassword_email_placeholder', |
| 1101 |
[ |
| 1102 |
'label' => esc_html__('Email Placeholder', 'king-addons'), |
| 1103 |
'type' => Controls_Manager::TEXT, |
| 1104 |
'default' => esc_html__('Enter your email address', 'king-addons'), |
| 1105 |
'dynamic' => ['active' => true], |
| 1106 |
'ai' => ['active' => false], |
| 1107 |
] |
| 1108 |
); |
| 1109 |
|
| 1110 |
$this->add_control( |
| 1111 |
'lostpassword_button_text', |
| 1112 |
[ |
| 1113 |
'label' => esc_html__('Button Text', 'king-addons'), |
| 1114 |
'type' => Controls_Manager::TEXT, |
| 1115 |
'default' => esc_html__('Reset Password', 'king-addons'), |
| 1116 |
'dynamic' => ['active' => true], |
| 1117 |
'ai' => ['active' => false], |
| 1118 |
] |
| 1119 |
); |
| 1120 |
|
| 1121 |
$this->add_control( |
| 1122 |
'show_login_link_from_lostpassword', |
| 1123 |
[ |
| 1124 |
'label' => esc_html__('Show Login Link', 'king-addons'), |
| 1125 |
'type' => Controls_Manager::SWITCHER, |
| 1126 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1127 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1128 |
'return_value' => 'yes', |
| 1129 |
'default' => 'yes', |
| 1130 |
] |
| 1131 |
); |
| 1132 |
|
| 1133 |
$this->add_control( |
| 1134 |
'login_link_text_from_lostpassword', |
| 1135 |
[ |
| 1136 |
'label' => esc_html__('Login Link Text', 'king-addons'), |
| 1137 |
'type' => Controls_Manager::TEXT, |
| 1138 |
'default' => esc_html__('Back to Login', 'king-addons'), |
| 1139 |
'condition' => [ |
| 1140 |
'show_login_link_from_lostpassword' => 'yes', |
| 1141 |
], |
| 1142 |
'dynamic' => ['active' => true], |
| 1143 |
'ai' => ['active' => false], |
| 1144 |
] |
| 1145 |
); |
| 1146 |
|
| 1147 |
$this->end_controls_section(); |
| 1148 |
|
| 1149 |
// Social Login Section |
| 1150 |
$this->start_controls_section( |
| 1151 |
'section_social_login', |
| 1152 |
[ |
| 1153 |
'label' => esc_html__('Social Login', 'king-addons'), |
| 1154 |
] |
| 1155 |
); |
| 1156 |
|
| 1157 |
$this->add_control( |
| 1158 |
'enable_social_login', |
| 1159 |
[ |
| 1160 |
'label' => sprintf(__('Enable Social Login %s', 'king-addons'), '<i class="eicon-pro-icon"></i>'), |
| 1161 |
'type' => Controls_Manager::SWITCHER, |
| 1162 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1163 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1164 |
'return_value' => 'yes', |
| 1165 |
'default' => '', |
| 1166 |
'classes' => 'king-addons-pro-control', |
| 1167 |
] |
| 1168 |
); |
| 1169 |
|
| 1170 |
if (!king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 1171 |
\King_Addons\Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'login-register-form', 'enable_social_login', ['yes']); |
| 1172 |
} else { |
| 1173 |
$this->add_control( |
| 1174 |
'social_login_separator', |
| 1175 |
[ |
| 1176 |
'label' => esc_html__('Show Separator', 'king-addons'), |
| 1177 |
'type' => Controls_Manager::SWITCHER, |
| 1178 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1179 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1180 |
'return_value' => 'yes', |
| 1181 |
'default' => 'yes', |
| 1182 |
'condition' => [ |
| 1183 |
'enable_social_login' => 'yes', |
| 1184 |
], |
| 1185 |
] |
| 1186 |
); |
| 1187 |
|
| 1188 |
$this->add_control( |
| 1189 |
'social_login_setup_note', |
| 1190 |
[ |
| 1191 |
'type' => Controls_Manager::RAW_HTML, |
| 1192 |
'raw' => esc_html__('Note: Social login requires proper API setup. Google and Facebook apps need to be configured with valid credentials.', 'king-addons'), |
| 1193 |
'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', |
| 1194 |
'condition' => [ |
| 1195 |
'enable_social_login' => 'yes', |
| 1196 |
], |
| 1197 |
] |
| 1198 |
); |
| 1199 |
|
| 1200 |
// Google Login Settings |
| 1201 |
$this->add_control( |
| 1202 |
'google_login_heading', |
| 1203 |
[ |
| 1204 |
'label' => esc_html__('Google Login', 'king-addons'), |
| 1205 |
'type' => Controls_Manager::HEADING, |
| 1206 |
'separator' => 'before', |
| 1207 |
'condition' => [ |
| 1208 |
'enable_social_login' => 'yes', |
| 1209 |
], |
| 1210 |
] |
| 1211 |
); |
| 1212 |
|
| 1213 |
$this->add_control( |
| 1214 |
'enable_google_login', |
| 1215 |
[ |
| 1216 |
'label' => esc_html__('Enable Google Login', 'king-addons'), |
| 1217 |
'type' => Controls_Manager::SWITCHER, |
| 1218 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1219 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1220 |
'return_value' => 'yes', |
| 1221 |
'default' => '', |
| 1222 |
'condition' => [ |
| 1223 |
'enable_social_login' => 'yes', |
| 1224 |
], |
| 1225 |
] |
| 1226 |
); |
| 1227 |
|
| 1228 |
$this->add_control( |
| 1229 |
'google_client_id', |
| 1230 |
[ |
| 1231 |
'label' => esc_html__('Google Client ID', 'king-addons'), |
| 1232 |
'type' => Controls_Manager::TEXT, |
| 1233 |
'placeholder' => esc_html__('Enter your Google Client ID', 'king-addons'), |
| 1234 |
'condition' => [ |
| 1235 |
'enable_social_login' => 'yes', |
| 1236 |
'enable_google_login' => 'yes', |
| 1237 |
], |
| 1238 |
'dynamic' => ['active' => true], |
| 1239 |
'ai' => ['active' => false], |
| 1240 |
] |
| 1241 |
); |
| 1242 |
|
| 1243 |
$this->add_control( |
| 1244 |
'google_client_secret', |
| 1245 |
[ |
| 1246 |
'label' => esc_html__('Google Client Secret', 'king-addons'), |
| 1247 |
'type' => Controls_Manager::TEXT, |
| 1248 |
'placeholder' => esc_html__('Enter your Google Client Secret', 'king-addons'), |
| 1249 |
'condition' => [ |
| 1250 |
'enable_social_login' => 'yes', |
| 1251 |
'enable_google_login' => 'yes', |
| 1252 |
], |
| 1253 |
'dynamic' => ['active' => true], |
| 1254 |
'ai' => ['active' => false], |
| 1255 |
] |
| 1256 |
); |
| 1257 |
|
| 1258 |
$this->add_control( |
| 1259 |
'google_setup_instructions', |
| 1260 |
[ |
| 1261 |
'type' => Controls_Manager::RAW_HTML, |
| 1262 |
'raw' => sprintf( |
| 1263 |
'<div style="background: #f8f9fa; padding: 15px; border-radius: 5px; margin: 10px 0;"> |
| 1264 |
<h4 style="margin: 0 0 10px 0;">🔧 Google OAuth Setup Instructions:</h4> |
| 1265 |
<ol style="margin: 0; padding-left: 20px;"> |
| 1266 |
<li>Go to <a href="https://console.cloud.google.com/" target="_blank">Google Cloud Console</a></li> |
| 1267 |
<li>Create a new project or select existing one</li> |
| 1268 |
<li>Enable "Google+ API" in APIs & Services</li> |
| 1269 |
<li>Go to "Credentials" → "Create Credentials" → "OAuth 2.0 Client IDs"</li> |
| 1270 |
<li>Set Application type to "Web application"</li> |
| 1271 |
<li>Add your domain to "Authorized JavaScript origins"</li> |
| 1272 |
<li>Add redirect URI: <code>%s</code></li> |
| 1273 |
<li>Copy Client ID and Client Secret to fields above</li> |
| 1274 |
</ol> |
| 1275 |
</div>', |
| 1276 |
home_url('/wp-admin/admin-ajax.php?action=king_addons_google_callback') |
| 1277 |
), |
| 1278 |
'condition' => [ |
| 1279 |
'enable_social_login' => 'yes', |
| 1280 |
'enable_google_login' => 'yes', |
| 1281 |
], |
| 1282 |
] |
| 1283 |
); |
| 1284 |
|
| 1285 |
// Facebook Login Settings |
| 1286 |
$this->add_control( |
| 1287 |
'facebook_login_heading', |
| 1288 |
[ |
| 1289 |
'label' => esc_html__('Facebook Login', 'king-addons'), |
| 1290 |
'type' => Controls_Manager::HEADING, |
| 1291 |
'separator' => 'before', |
| 1292 |
'condition' => [ |
| 1293 |
'enable_social_login' => 'yes', |
| 1294 |
], |
| 1295 |
] |
| 1296 |
); |
| 1297 |
|
| 1298 |
$this->add_control( |
| 1299 |
'enable_facebook_login', |
| 1300 |
[ |
| 1301 |
'label' => esc_html__('Enable Facebook Login', 'king-addons'), |
| 1302 |
'type' => Controls_Manager::SWITCHER, |
| 1303 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1304 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1305 |
'return_value' => 'yes', |
| 1306 |
'default' => '', |
| 1307 |
'condition' => [ |
| 1308 |
'enable_social_login' => 'yes', |
| 1309 |
], |
| 1310 |
] |
| 1311 |
); |
| 1312 |
|
| 1313 |
$this->add_control( |
| 1314 |
'facebook_app_id', |
| 1315 |
[ |
| 1316 |
'label' => esc_html__('Facebook App ID', 'king-addons'), |
| 1317 |
'type' => Controls_Manager::TEXT, |
| 1318 |
'placeholder' => esc_html__('Enter your Facebook App ID', 'king-addons'), |
| 1319 |
'condition' => [ |
| 1320 |
'enable_social_login' => 'yes', |
| 1321 |
'enable_facebook_login' => 'yes', |
| 1322 |
], |
| 1323 |
'dynamic' => ['active' => true], |
| 1324 |
'ai' => ['active' => false], |
| 1325 |
] |
| 1326 |
); |
| 1327 |
|
| 1328 |
$this->add_control( |
| 1329 |
'facebook_app_secret', |
| 1330 |
[ |
| 1331 |
'label' => esc_html__('Facebook App Secret', 'king-addons'), |
| 1332 |
'type' => Controls_Manager::TEXT, |
| 1333 |
'placeholder' => esc_html__('Enter your Facebook App Secret', 'king-addons'), |
| 1334 |
'condition' => [ |
| 1335 |
'enable_social_login' => 'yes', |
| 1336 |
'enable_facebook_login' => 'yes', |
| 1337 |
], |
| 1338 |
'dynamic' => ['active' => true], |
| 1339 |
'ai' => ['active' => false], |
| 1340 |
] |
| 1341 |
); |
| 1342 |
|
| 1343 |
$this->add_control( |
| 1344 |
'facebook_setup_instructions', |
| 1345 |
[ |
| 1346 |
'type' => Controls_Manager::RAW_HTML, |
| 1347 |
'raw' => sprintf( |
| 1348 |
'<div style="background: #f8f9fa; padding: 15px; border-radius: 5px; margin: 10px 0;"> |
| 1349 |
<h4 style="margin: 0 0 10px 0;">🔧 Facebook OAuth Setup Instructions:</h4> |
| 1350 |
<ol style="margin: 0; padding-left: 20px;"> |
| 1351 |
<li>Go to <a href="https://developers.facebook.com/" target="_blank">Facebook Developers</a></li> |
| 1352 |
<li>Create a new app or select existing one</li> |
| 1353 |
<li>Add "Facebook Login" product to your app</li> |
| 1354 |
<li>Go to Facebook Login → Settings</li> |
| 1355 |
<li>Add Valid OAuth Redirect URI: <code>%s</code></li> |
| 1356 |
<li>Get App ID and App Secret from App Settings → Basic</li> |
| 1357 |
<li>Copy App ID and App Secret to fields above</li> |
| 1358 |
<li>Make sure app is live (not in development mode)</li> |
| 1359 |
</ol> |
| 1360 |
</div>', |
| 1361 |
home_url('/wp-admin/admin-ajax.php?action=king_addons_facebook_callback') |
| 1362 |
), |
| 1363 |
'condition' => [ |
| 1364 |
'enable_social_login' => 'yes', |
| 1365 |
'enable_facebook_login' => 'yes', |
| 1366 |
], |
| 1367 |
] |
| 1368 |
); |
| 1369 |
} |
| 1370 |
|
| 1371 |
$this->end_controls_section(); |
| 1372 |
|
| 1373 |
// reCAPTCHA Section |
| 1374 |
$this->start_controls_section( |
| 1375 |
'section_recaptcha', |
| 1376 |
[ |
| 1377 |
'label' => esc_html__('reCAPTCHA', 'king-addons'), |
| 1378 |
] |
| 1379 |
); |
| 1380 |
|
| 1381 |
$this->add_control( |
| 1382 |
'enable_recaptcha', |
| 1383 |
[ |
| 1384 |
'label' => esc_html__('Enable reCAPTCHA', 'king-addons'), |
| 1385 |
'type' => Controls_Manager::SWITCHER, |
| 1386 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1387 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1388 |
'return_value' => 'yes', |
| 1389 |
'default' => '', |
| 1390 |
] |
| 1391 |
); |
| 1392 |
|
| 1393 |
$this->add_control( |
| 1394 |
'recaptcha_version', |
| 1395 |
[ |
| 1396 |
'label' => esc_html__('reCAPTCHA Version', 'king-addons'), |
| 1397 |
'type' => Controls_Manager::SELECT, |
| 1398 |
'options' => [ |
| 1399 |
'v2' => esc_html__('reCAPTCHA v2', 'king-addons'), |
| 1400 |
'v3' => esc_html__('reCAPTCHA v3', 'king-addons'), |
| 1401 |
], |
| 1402 |
'default' => 'v2', |
| 1403 |
'condition' => [ |
| 1404 |
'enable_recaptcha' => 'yes', |
| 1405 |
], |
| 1406 |
] |
| 1407 |
); |
| 1408 |
|
| 1409 |
$this->add_control( |
| 1410 |
'recaptcha_site_key', |
| 1411 |
[ |
| 1412 |
'label' => esc_html__('Site Key', 'king-addons'), |
| 1413 |
'type' => Controls_Manager::TEXT, |
| 1414 |
'placeholder' => esc_html__('Enter your reCAPTCHA Site Key', 'king-addons'), |
| 1415 |
'condition' => [ |
| 1416 |
'enable_recaptcha' => 'yes', |
| 1417 |
], |
| 1418 |
'dynamic' => ['active' => true], |
| 1419 |
'ai' => ['active' => false], |
| 1420 |
] |
| 1421 |
); |
| 1422 |
|
| 1423 |
$this->add_control( |
| 1424 |
'recaptcha_secret_key', |
| 1425 |
[ |
| 1426 |
'label' => esc_html__('Secret Key', 'king-addons'), |
| 1427 |
'type' => Controls_Manager::TEXT, |
| 1428 |
'placeholder' => esc_html__('Enter your reCAPTCHA Secret Key', 'king-addons'), |
| 1429 |
'condition' => [ |
| 1430 |
'enable_recaptcha' => 'yes', |
| 1431 |
], |
| 1432 |
'dynamic' => ['active' => true], |
| 1433 |
'ai' => ['active' => false], |
| 1434 |
] |
| 1435 |
); |
| 1436 |
|
| 1437 |
$this->add_control( |
| 1438 |
'recaptcha_theme', |
| 1439 |
[ |
| 1440 |
'label' => esc_html__('Theme', 'king-addons'), |
| 1441 |
'type' => Controls_Manager::SELECT, |
| 1442 |
'options' => [ |
| 1443 |
'light' => esc_html__('Light', 'king-addons'), |
| 1444 |
'dark' => esc_html__('Dark', 'king-addons'), |
| 1445 |
], |
| 1446 |
'default' => 'light', |
| 1447 |
'condition' => [ |
| 1448 |
'enable_recaptcha' => 'yes', |
| 1449 |
'recaptcha_version' => 'v2', |
| 1450 |
], |
| 1451 |
] |
| 1452 |
); |
| 1453 |
|
| 1454 |
$this->add_control( |
| 1455 |
'recaptcha_size', |
| 1456 |
[ |
| 1457 |
'label' => esc_html__('Size', 'king-addons'), |
| 1458 |
'type' => Controls_Manager::SELECT, |
| 1459 |
'options' => [ |
| 1460 |
'normal' => esc_html__('Normal', 'king-addons'), |
| 1461 |
'compact' => esc_html__('Compact', 'king-addons'), |
| 1462 |
], |
| 1463 |
'default' => 'normal', |
| 1464 |
'condition' => [ |
| 1465 |
'enable_recaptcha' => 'yes', |
| 1466 |
'recaptcha_version' => 'v2', |
| 1467 |
], |
| 1468 |
] |
| 1469 |
); |
| 1470 |
|
| 1471 |
$this->add_control( |
| 1472 |
'recaptcha_score_threshold', |
| 1473 |
[ |
| 1474 |
'label' => esc_html__('Score Threshold', 'king-addons'), |
| 1475 |
'type' => Controls_Manager::SLIDER, |
| 1476 |
'range' => [ |
| 1477 |
'' => [ |
| 1478 |
'min' => 0, |
| 1479 |
'max' => 1, |
| 1480 |
'step' => 0.1, |
| 1481 |
], |
| 1482 |
], |
| 1483 |
'default' => [ |
| 1484 |
'size' => 0.5, |
| 1485 |
], |
| 1486 |
'condition' => [ |
| 1487 |
'enable_recaptcha' => 'yes', |
| 1488 |
'recaptcha_version' => 'v3', |
| 1489 |
], |
| 1490 |
'description' => esc_html__('reCAPTCHA v3 returns a score (1.0 is very likely a good interaction, 0.0 is very likely a bot). Based on the score, you can take variable action in the context of your site.', 'king-addons'), |
| 1491 |
] |
| 1492 |
); |
| 1493 |
|
| 1494 |
$this->add_control( |
| 1495 |
'recaptcha_hide_badge', |
| 1496 |
[ |
| 1497 |
'label' => esc_html__('Hide reCAPTCHA Badge', 'king-addons'), |
| 1498 |
'type' => Controls_Manager::SWITCHER, |
| 1499 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1500 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1501 |
'return_value' => 'yes', |
| 1502 |
'default' => '', |
| 1503 |
'condition' => [ |
| 1504 |
'enable_recaptcha' => 'yes', |
| 1505 |
'recaptcha_version' => 'v3', |
| 1506 |
], |
| 1507 |
'description' => esc_html__('Hide the reCAPTCHA badge. Note: You must include the reCAPTCHA branding visibly in the user flow.', 'king-addons'), |
| 1508 |
] |
| 1509 |
); |
| 1510 |
|
| 1511 |
$this->add_control( |
| 1512 |
'recaptcha_apply_on', |
| 1513 |
[ |
| 1514 |
'label' => esc_html__('Apply reCAPTCHA On', 'king-addons'), |
| 1515 |
'type' => Controls_Manager::SELECT2, |
| 1516 |
'multiple' => true, |
| 1517 |
'options' => [ |
| 1518 |
'login' => esc_html__('Login Form', 'king-addons'), |
| 1519 |
'register' => esc_html__('Register Form', 'king-addons'), |
| 1520 |
'lostpassword' => esc_html__('Lost Password Form', 'king-addons'), |
| 1521 |
], |
| 1522 |
'default' => ['login', 'register'], |
| 1523 |
'condition' => [ |
| 1524 |
'enable_recaptcha' => 'yes', |
| 1525 |
], |
| 1526 |
] |
| 1527 |
); |
| 1528 |
|
| 1529 |
$this->add_control( |
| 1530 |
'recaptcha_setup_note', |
| 1531 |
[ |
| 1532 |
'type' => Controls_Manager::RAW_HTML, |
| 1533 |
'raw' => sprintf( |
| 1534 |
esc_html__('To use reCAPTCHA, you need to get API keys from %s. For more details, check the documentation.', 'king-addons'), |
| 1535 |
'<a href="https://www.google.com/recaptcha/" target="_blank">Google reCAPTCHA</a>' |
| 1536 |
), |
| 1537 |
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1538 |
'condition' => [ |
| 1539 |
'enable_recaptcha' => 'yes', |
| 1540 |
], |
| 1541 |
] |
| 1542 |
); |
| 1543 |
|
| 1544 |
$this->end_controls_section(); |
| 1545 |
|
| 1546 |
// Register Form Section |
| 1547 |
$this->start_controls_section( |
| 1548 |
'section_register_form', |
| 1549 |
[ |
| 1550 |
'label' => esc_html__('Register Form', 'king-addons'), |
| 1551 |
] |
| 1552 |
); |
| 1553 |
|
| 1554 |
$this->add_control( |
| 1555 |
'register_form_title', |
| 1556 |
[ |
| 1557 |
'label' => esc_html__('Form Title', 'king-addons'), |
| 1558 |
'type' => Controls_Manager::TEXT, |
| 1559 |
'default' => esc_html__('Create New Account', 'king-addons'), |
| 1560 |
'placeholder' => esc_html__('Enter title', 'king-addons'), |
| 1561 |
'dynamic' => ['active' => true], |
| 1562 |
'ai' => ['active' => false], |
| 1563 |
] |
| 1564 |
); |
| 1565 |
|
| 1566 |
$this->add_control( |
| 1567 |
'register_form_subtitle', |
| 1568 |
[ |
| 1569 |
'label' => esc_html__('Form Subtitle', 'king-addons'), |
| 1570 |
'type' => Controls_Manager::TEXTAREA, |
| 1571 |
'default' => esc_html__('Create an account to enjoy awesome features.', 'king-addons'), |
| 1572 |
'placeholder' => esc_html__('Enter subtitle', 'king-addons'), |
| 1573 |
'dynamic' => ['active' => true], |
| 1574 |
] |
| 1575 |
); |
| 1576 |
|
| 1577 |
$this->add_control( |
| 1578 |
'register_email_label', |
| 1579 |
[ |
| 1580 |
'label' => esc_html__('Email Label', 'king-addons'), |
| 1581 |
'type' => Controls_Manager::TEXT, |
| 1582 |
'default' => esc_html__('Email', 'king-addons'), |
| 1583 |
'dynamic' => ['active' => true], |
| 1584 |
'ai' => ['active' => false], |
| 1585 |
] |
| 1586 |
); |
| 1587 |
|
| 1588 |
$this->add_control( |
| 1589 |
'register_email_placeholder', |
| 1590 |
[ |
| 1591 |
'label' => esc_html__('Email Placeholder', 'king-addons'), |
| 1592 |
'type' => Controls_Manager::TEXT, |
| 1593 |
'default' => esc_html__('Enter your email', 'king-addons'), |
| 1594 |
'dynamic' => ['active' => true], |
| 1595 |
'ai' => ['active' => false], |
| 1596 |
] |
| 1597 |
); |
| 1598 |
|
| 1599 |
$this->add_control( |
| 1600 |
'register_username_label', |
| 1601 |
[ |
| 1602 |
'label' => esc_html__('Username Label', 'king-addons'), |
| 1603 |
'type' => Controls_Manager::TEXT, |
| 1604 |
'default' => esc_html__('Username', 'king-addons'), |
| 1605 |
'dynamic' => ['active' => true], |
| 1606 |
'ai' => ['active' => false], |
| 1607 |
] |
| 1608 |
); |
| 1609 |
|
| 1610 |
$this->add_control( |
| 1611 |
'register_username_placeholder', |
| 1612 |
[ |
| 1613 |
'label' => esc_html__('Username Placeholder', 'king-addons'), |
| 1614 |
'type' => Controls_Manager::TEXT, |
| 1615 |
'default' => esc_html__('Enter your username', 'king-addons'), |
| 1616 |
'dynamic' => ['active' => true], |
| 1617 |
'ai' => ['active' => false], |
| 1618 |
] |
| 1619 |
); |
| 1620 |
|
| 1621 |
$this->add_control( |
| 1622 |
'register_password_label', |
| 1623 |
[ |
| 1624 |
'label' => esc_html__('Password Label', 'king-addons'), |
| 1625 |
'type' => Controls_Manager::TEXT, |
| 1626 |
'default' => esc_html__('Password', 'king-addons'), |
| 1627 |
'dynamic' => ['active' => true], |
| 1628 |
'ai' => ['active' => false], |
| 1629 |
] |
| 1630 |
); |
| 1631 |
|
| 1632 |
$this->add_control( |
| 1633 |
'register_password_placeholder', |
| 1634 |
[ |
| 1635 |
'label' => esc_html__('Password Placeholder', 'king-addons'), |
| 1636 |
'type' => Controls_Manager::TEXT, |
| 1637 |
'default' => esc_html__('Enter your password', 'king-addons'), |
| 1638 |
'dynamic' => ['active' => true], |
| 1639 |
'ai' => ['active' => false], |
| 1640 |
] |
| 1641 |
); |
| 1642 |
|
| 1643 |
$this->add_control( |
| 1644 |
'register_confirm_password_label', |
| 1645 |
[ |
| 1646 |
'label' => esc_html__('Confirm Password Label', 'king-addons'), |
| 1647 |
'type' => Controls_Manager::TEXT, |
| 1648 |
'default' => esc_html__('Confirm Password', 'king-addons'), |
| 1649 |
'dynamic' => ['active' => true], |
| 1650 |
'ai' => ['active' => false], |
| 1651 |
] |
| 1652 |
); |
| 1653 |
|
| 1654 |
$this->add_control( |
| 1655 |
'register_confirm_password_placeholder', |
| 1656 |
[ |
| 1657 |
'label' => esc_html__('Confirm Password Placeholder', 'king-addons'), |
| 1658 |
'type' => Controls_Manager::TEXT, |
| 1659 |
'default' => esc_html__('Confirm your password', 'king-addons'), |
| 1660 |
'dynamic' => ['active' => true], |
| 1661 |
'ai' => ['active' => false], |
| 1662 |
] |
| 1663 |
); |
| 1664 |
|
| 1665 |
$this->add_control( |
| 1666 |
'register_additional_fields_heading', |
| 1667 |
[ |
| 1668 |
'label' => esc_html__('Additional Fields', 'king-addons'), |
| 1669 |
'type' => Controls_Manager::HEADING, |
| 1670 |
'separator' => 'before', |
| 1671 |
] |
| 1672 |
); |
| 1673 |
|
| 1674 |
$this->add_control( |
| 1675 |
'show_first_name', |
| 1676 |
[ |
| 1677 |
'label' => esc_html__('Show First Name', 'king-addons'), |
| 1678 |
'type' => Controls_Manager::SWITCHER, |
| 1679 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1680 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1681 |
'return_value' => 'yes', |
| 1682 |
'default' => '', |
| 1683 |
] |
| 1684 |
); |
| 1685 |
|
| 1686 |
$this->add_control( |
| 1687 |
'register_first_name_label', |
| 1688 |
[ |
| 1689 |
'label' => esc_html__('First Name Label', 'king-addons'), |
| 1690 |
'type' => Controls_Manager::TEXT, |
| 1691 |
'default' => esc_html__('First Name', 'king-addons'), |
| 1692 |
'condition' => [ |
| 1693 |
'show_first_name' => 'yes', |
| 1694 |
], |
| 1695 |
'dynamic' => ['active' => true], |
| 1696 |
'ai' => ['active' => false], |
| 1697 |
] |
| 1698 |
); |
| 1699 |
|
| 1700 |
$this->add_control( |
| 1701 |
'register_first_name_placeholder', |
| 1702 |
[ |
| 1703 |
'label' => esc_html__('First Name Placeholder', 'king-addons'), |
| 1704 |
'type' => Controls_Manager::TEXT, |
| 1705 |
'default' => esc_html__('First Name', 'king-addons'), |
| 1706 |
'condition' => [ |
| 1707 |
'show_first_name' => 'yes', |
| 1708 |
], |
| 1709 |
'dynamic' => ['active' => true], |
| 1710 |
'ai' => ['active' => false], |
| 1711 |
] |
| 1712 |
); |
| 1713 |
|
| 1714 |
$this->add_control( |
| 1715 |
'show_last_name', |
| 1716 |
[ |
| 1717 |
'label' => esc_html__('Show Last Name', 'king-addons'), |
| 1718 |
'type' => Controls_Manager::SWITCHER, |
| 1719 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1720 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1721 |
'return_value' => 'yes', |
| 1722 |
'default' => '', |
| 1723 |
] |
| 1724 |
); |
| 1725 |
|
| 1726 |
$this->add_control( |
| 1727 |
'register_last_name_label', |
| 1728 |
[ |
| 1729 |
'label' => esc_html__('Last Name Label', 'king-addons'), |
| 1730 |
'type' => Controls_Manager::TEXT, |
| 1731 |
'default' => esc_html__('Last Name', 'king-addons'), |
| 1732 |
'condition' => [ |
| 1733 |
'show_last_name' => 'yes', |
| 1734 |
], |
| 1735 |
'dynamic' => ['active' => true], |
| 1736 |
'ai' => ['active' => false], |
| 1737 |
] |
| 1738 |
); |
| 1739 |
|
| 1740 |
$this->add_control( |
| 1741 |
'register_last_name_placeholder', |
| 1742 |
[ |
| 1743 |
'label' => esc_html__('Last Name Placeholder', 'king-addons'), |
| 1744 |
'type' => Controls_Manager::TEXT, |
| 1745 |
'default' => esc_html__('Last Name', 'king-addons'), |
| 1746 |
'condition' => [ |
| 1747 |
'show_last_name' => 'yes', |
| 1748 |
], |
| 1749 |
'dynamic' => ['active' => true], |
| 1750 |
'ai' => ['active' => false], |
| 1751 |
] |
| 1752 |
); |
| 1753 |
|
| 1754 |
$this->add_control( |
| 1755 |
'show_website', |
| 1756 |
[ |
| 1757 |
'label' => esc_html__('Show Website', 'king-addons'), |
| 1758 |
'type' => Controls_Manager::SWITCHER, |
| 1759 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1760 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1761 |
'return_value' => 'yes', |
| 1762 |
'default' => '', |
| 1763 |
] |
| 1764 |
); |
| 1765 |
|
| 1766 |
$this->add_control( |
| 1767 |
'register_website_label', |
| 1768 |
[ |
| 1769 |
'label' => esc_html__('Website Label', 'king-addons'), |
| 1770 |
'type' => Controls_Manager::TEXT, |
| 1771 |
'default' => esc_html__('Website', 'king-addons'), |
| 1772 |
'condition' => [ |
| 1773 |
'show_website' => 'yes', |
| 1774 |
], |
| 1775 |
'dynamic' => ['active' => true], |
| 1776 |
'ai' => ['active' => false], |
| 1777 |
] |
| 1778 |
); |
| 1779 |
|
| 1780 |
$this->add_control( |
| 1781 |
'register_website_placeholder', |
| 1782 |
[ |
| 1783 |
'label' => esc_html__('Website Placeholder', 'king-addons'), |
| 1784 |
'type' => Controls_Manager::TEXT, |
| 1785 |
'default' => esc_html__('https://yourwebsite.com', 'king-addons'), |
| 1786 |
'condition' => [ |
| 1787 |
'show_website' => 'yes', |
| 1788 |
], |
| 1789 |
'dynamic' => ['active' => true], |
| 1790 |
'ai' => ['active' => false], |
| 1791 |
] |
| 1792 |
); |
| 1793 |
|
| 1794 |
$this->add_control( |
| 1795 |
'show_phone', |
| 1796 |
[ |
| 1797 |
'label' => esc_html__('Show Phone', 'king-addons'), |
| 1798 |
'type' => Controls_Manager::SWITCHER, |
| 1799 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1800 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1801 |
'return_value' => 'yes', |
| 1802 |
'default' => '', |
| 1803 |
] |
| 1804 |
); |
| 1805 |
|
| 1806 |
$this->add_control( |
| 1807 |
'register_phone_label', |
| 1808 |
[ |
| 1809 |
'label' => esc_html__('Phone Label', 'king-addons'), |
| 1810 |
'type' => Controls_Manager::TEXT, |
| 1811 |
'default' => esc_html__('Phone', 'king-addons'), |
| 1812 |
'condition' => [ |
| 1813 |
'show_phone' => 'yes', |
| 1814 |
], |
| 1815 |
'dynamic' => ['active' => true], |
| 1816 |
'ai' => ['active' => false], |
| 1817 |
] |
| 1818 |
); |
| 1819 |
|
| 1820 |
$this->add_control( |
| 1821 |
'register_phone_placeholder', |
| 1822 |
[ |
| 1823 |
'label' => esc_html__('Phone Placeholder', 'king-addons'), |
| 1824 |
'type' => Controls_Manager::TEXT, |
| 1825 |
'default' => esc_html__('Phone Number', 'king-addons'), |
| 1826 |
'condition' => [ |
| 1827 |
'show_phone' => 'yes', |
| 1828 |
], |
| 1829 |
'dynamic' => ['active' => true], |
| 1830 |
'ai' => ['active' => false], |
| 1831 |
] |
| 1832 |
); |
| 1833 |
|
| 1834 |
$this->add_control( |
| 1835 |
'register_button_text', |
| 1836 |
[ |
| 1837 |
'label' => esc_html__('Register Button Text', 'king-addons'), |
| 1838 |
'type' => Controls_Manager::TEXT, |
| 1839 |
'default' => esc_html__('Register', 'king-addons'), |
| 1840 |
'dynamic' => ['active' => true], |
| 1841 |
'ai' => ['active' => false], |
| 1842 |
] |
| 1843 |
); |
| 1844 |
|
| 1845 |
$this->add_control( |
| 1846 |
'show_password_visibility_register', |
| 1847 |
[ |
| 1848 |
'label' => esc_html__('Show Password Visibility Toggle', 'king-addons'), |
| 1849 |
'type' => Controls_Manager::SWITCHER, |
| 1850 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1851 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1852 |
'return_value' => 'yes', |
| 1853 |
'default' => 'yes', |
| 1854 |
] |
| 1855 |
); |
| 1856 |
|
| 1857 |
$this->add_control( |
| 1858 |
'show_login_link', |
| 1859 |
[ |
| 1860 |
'label' => esc_html__('Show Login Link', 'king-addons'), |
| 1861 |
'type' => Controls_Manager::SWITCHER, |
| 1862 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1863 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1864 |
'return_value' => 'yes', |
| 1865 |
'default' => 'yes', |
| 1866 |
] |
| 1867 |
); |
| 1868 |
|
| 1869 |
$this->add_control( |
| 1870 |
'login_link_text', |
| 1871 |
[ |
| 1872 |
'label' => esc_html__('Login Link Text', 'king-addons'), |
| 1873 |
'type' => Controls_Manager::TEXT, |
| 1874 |
'default' => esc_html__('Already have an account? Login', 'king-addons'), |
| 1875 |
'condition' => [ |
| 1876 |
'show_login_link' => 'yes', |
| 1877 |
], |
| 1878 |
'dynamic' => ['active' => true], |
| 1879 |
'ai' => ['active' => false], |
| 1880 |
] |
| 1881 |
); |
| 1882 |
|
| 1883 |
// Custom Fields for Registration |
| 1884 |
$this->add_control( |
| 1885 |
'custom_fields_heading', |
| 1886 |
[ |
| 1887 |
'label' => sprintf(__('Custom Fields %s', 'king-addons'), '<i class="eicon-pro-icon"></i>'), |
| 1888 |
'type' => Controls_Manager::HEADING, |
| 1889 |
'separator' => 'before', |
| 1890 |
] |
| 1891 |
); |
| 1892 |
|
| 1893 |
if (!king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 1894 |
$this->add_control( |
| 1895 |
'custom_fields_pro_notice', |
| 1896 |
[ |
| 1897 |
'type' => Controls_Manager::RAW_HTML, |
| 1898 |
'raw' => 'Custom Registration Fields are available<br> in the <strong><a href="https://kingaddons.com/pricing/?utm_source=kng-module-login-register-form-settings-upgrade-pro&utm_medium=plugin&utm_campaign=kng" target="_blank">Pro version</a></strong>', |
| 1899 |
'content_classes' => 'king-addons-pro-notice', |
| 1900 |
] |
| 1901 |
); |
| 1902 |
} else { |
| 1903 |
$repeater = new \Elementor\Repeater(); |
| 1904 |
|
| 1905 |
$repeater->add_control( |
| 1906 |
'field_type', |
| 1907 |
[ |
| 1908 |
'label' => esc_html__('Field Type', 'king-addons'), |
| 1909 |
'type' => Controls_Manager::SELECT, |
| 1910 |
'options' => [ |
| 1911 |
'text' => esc_html__('Text', 'king-addons'), |
| 1912 |
'email' => esc_html__('Email', 'king-addons'), |
| 1913 |
'number' => esc_html__('Number', 'king-addons'), |
| 1914 |
'tel' => esc_html__('Phone', 'king-addons'), |
| 1915 |
'url' => esc_html__('URL', 'king-addons'), |
| 1916 |
'textarea' => esc_html__('Textarea', 'king-addons'), |
| 1917 |
'select' => esc_html__('Select', 'king-addons'), |
| 1918 |
'checkbox' => esc_html__('Checkbox', 'king-addons'), |
| 1919 |
'radio' => esc_html__('Radio', 'king-addons'), |
| 1920 |
'date' => esc_html__('Date', 'king-addons'), |
| 1921 |
'file' => esc_html__('File Upload', 'king-addons'), |
| 1922 |
], |
| 1923 |
'default' => 'text', |
| 1924 |
] |
| 1925 |
); |
| 1926 |
|
| 1927 |
$repeater->add_control( |
| 1928 |
'field_label', |
| 1929 |
[ |
| 1930 |
'label' => esc_html__('Field Label', 'king-addons'), |
| 1931 |
'type' => Controls_Manager::TEXT, |
| 1932 |
'default' => esc_html__('Custom Field', 'king-addons'), |
| 1933 |
'dynamic' => ['active' => true], |
| 1934 |
] |
| 1935 |
); |
| 1936 |
|
| 1937 |
$repeater->add_control( |
| 1938 |
'field_placeholder', |
| 1939 |
[ |
| 1940 |
'label' => esc_html__('Placeholder', 'king-addons'), |
| 1941 |
'type' => Controls_Manager::TEXT, |
| 1942 |
'dynamic' => ['active' => true], |
| 1943 |
'condition' => [ |
| 1944 |
'field_type!' => ['checkbox', 'radio', 'file'], |
| 1945 |
], |
| 1946 |
] |
| 1947 |
); |
| 1948 |
|
| 1949 |
$repeater->add_control( |
| 1950 |
'field_required', |
| 1951 |
[ |
| 1952 |
'label' => esc_html__('Required', 'king-addons'), |
| 1953 |
'type' => Controls_Manager::SWITCHER, |
| 1954 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 1955 |
'label_off' => esc_html__('No', 'king-addons'), |
| 1956 |
'return_value' => 'yes', |
| 1957 |
'default' => '', |
| 1958 |
] |
| 1959 |
); |
| 1960 |
|
| 1961 |
$repeater->add_control( |
| 1962 |
'field_options', |
| 1963 |
[ |
| 1964 |
'label' => esc_html__('Options', 'king-addons'), |
| 1965 |
'type' => Controls_Manager::TEXTAREA, |
| 1966 |
'description' => esc_html__('Enter each option on a new line. For radio/checkbox use format: value|label', 'king-addons'), |
| 1967 |
'condition' => [ |
| 1968 |
'field_type' => ['select', 'checkbox', 'radio'], |
| 1969 |
], |
| 1970 |
'default' => "option1|Option 1\noption2|Option 2\noption3|Option 3", |
| 1971 |
] |
| 1972 |
); |
| 1973 |
|
| 1974 |
$repeater->add_control( |
| 1975 |
'field_width', |
| 1976 |
[ |
| 1977 |
'label' => esc_html__('Field Width', 'king-addons'), |
| 1978 |
'type' => Controls_Manager::SELECT, |
| 1979 |
'options' => [ |
| 1980 |
'full' => esc_html__('Full Width', 'king-addons'), |
| 1981 |
'half' => esc_html__('Half Width', 'king-addons'), |
| 1982 |
], |
| 1983 |
'default' => 'full', |
| 1984 |
] |
| 1985 |
); |
| 1986 |
|
| 1987 |
$this->add_control( |
| 1988 |
'custom_fields', |
| 1989 |
[ |
| 1990 |
'label' => esc_html__('Additional Fields', 'king-addons'), |
| 1991 |
'type' => Controls_Manager::REPEATER, |
| 1992 |
'fields' => $repeater->get_controls(), |
| 1993 |
'title_field' => '{{{ field_label }}}', |
| 1994 |
'default' => [], |
| 1995 |
] |
| 1996 |
); |
| 1997 |
} |
| 1998 |
|
| 1999 |
// User Role Selection |
| 2000 |
$this->add_control( |
| 2001 |
'user_role_heading', |
| 2002 |
[ |
| 2003 |
'label' => esc_html__('User Role', 'king-addons'), |
| 2004 |
'type' => Controls_Manager::HEADING, |
| 2005 |
'separator' => 'before', |
| 2006 |
] |
| 2007 |
); |
| 2008 |
|
| 2009 |
$this->add_control( |
| 2010 |
'show_user_role_selection', |
| 2011 |
[ |
| 2012 |
'label' => esc_html__('Show User Role Selection', 'king-addons'), |
| 2013 |
'type' => Controls_Manager::SWITCHER, |
| 2014 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 2015 |
'label_off' => esc_html__('No', 'king-addons'), |
| 2016 |
'return_value' => 'yes', |
| 2017 |
'default' => '', |
| 2018 |
] |
| 2019 |
); |
| 2020 |
|
| 2021 |
$this->add_control( |
| 2022 |
'user_role_label', |
| 2023 |
[ |
| 2024 |
'label' => esc_html__('User Role Label', 'king-addons'), |
| 2025 |
'type' => Controls_Manager::TEXT, |
| 2026 |
'default' => esc_html__('Select Role', 'king-addons'), |
| 2027 |
'condition' => [ |
| 2028 |
'show_user_role_selection' => 'yes', |
| 2029 |
], |
| 2030 |
'dynamic' => ['active' => true], |
| 2031 |
'ai' => ['active' => false], |
| 2032 |
] |
| 2033 |
); |
| 2034 |
|
| 2035 |
$this->add_control( |
| 2036 |
'allowed_user_roles', |
| 2037 |
[ |
| 2038 |
'label' => esc_html__('Allowed User Roles', 'king-addons'), |
| 2039 |
'type' => Controls_Manager::SELECT2, |
| 2040 |
'multiple' => true, |
| 2041 |
'options' => $this->get_user_roles(), |
| 2042 |
'default' => ['subscriber'], |
| 2043 |
'condition' => [ |
| 2044 |
'show_user_role_selection' => 'yes', |
| 2045 |
], |
| 2046 |
] |
| 2047 |
); |
| 2048 |
|
| 2049 |
$this->add_control( |
| 2050 |
'default_user_role', |
| 2051 |
[ |
| 2052 |
'label' => esc_html__('Default User Role', 'king-addons'), |
| 2053 |
'type' => Controls_Manager::SELECT, |
| 2054 |
'options' => $this->get_user_roles(), |
| 2055 |
'default' => 'subscriber', |
| 2056 |
'condition' => [ |
| 2057 |
'show_user_role_selection' => 'yes', |
| 2058 |
], |
| 2059 |
] |
| 2060 |
); |
| 2061 |
|
| 2062 |
// Terms & Conditions |
| 2063 |
$this->add_control( |
| 2064 |
'terms_conditions_heading', |
| 2065 |
[ |
| 2066 |
'label' => esc_html__('Terms & Conditions', 'king-addons'), |
| 2067 |
'type' => Controls_Manager::HEADING, |
| 2068 |
'separator' => 'before', |
| 2069 |
] |
| 2070 |
); |
| 2071 |
|
| 2072 |
$this->add_control( |
| 2073 |
'show_terms_conditions', |
| 2074 |
[ |
| 2075 |
'label' => esc_html__('Show Terms & Conditions', 'king-addons'), |
| 2076 |
'type' => Controls_Manager::SWITCHER, |
| 2077 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 2078 |
'label_off' => esc_html__('No', 'king-addons'), |
| 2079 |
'return_value' => 'yes', |
| 2080 |
'default' => '', |
| 2081 |
] |
| 2082 |
); |
| 2083 |
|
| 2084 |
$this->add_control( |
| 2085 |
'terms_conditions_text', |
| 2086 |
[ |
| 2087 |
'label' => esc_html__('Terms & Conditions Text', 'king-addons'), |
| 2088 |
'type' => Controls_Manager::TEXTAREA, |
| 2089 |
'default' => esc_html__('I agree to the Terms & Conditions', 'king-addons'), |
| 2090 |
'condition' => [ |
| 2091 |
'show_terms_conditions' => 'yes', |
| 2092 |
], |
| 2093 |
'dynamic' => ['active' => true], |
| 2094 |
'ai' => ['active' => false], |
| 2095 |
] |
| 2096 |
); |
| 2097 |
|
| 2098 |
$this->add_control( |
| 2099 |
'terms_conditions_link', |
| 2100 |
[ |
| 2101 |
'label' => esc_html__('Terms & Conditions Link', 'king-addons'), |
| 2102 |
'type' => Controls_Manager::URL, |
| 2103 |
'placeholder' => esc_html__('https://yoursite.com/terms', 'king-addons'), |
| 2104 |
'condition' => [ |
| 2105 |
'show_terms_conditions' => 'yes', |
| 2106 |
], |
| 2107 |
'dynamic' => ['active' => true], |
| 2108 |
] |
| 2109 |
); |
| 2110 |
|
| 2111 |
$this->add_control( |
| 2112 |
'terms_required', |
| 2113 |
[ |
| 2114 |
'label' => esc_html__('Required', 'king-addons'), |
| 2115 |
'type' => Controls_Manager::SWITCHER, |
| 2116 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 2117 |
'label_off' => esc_html__('No', 'king-addons'), |
| 2118 |
'return_value' => 'yes', |
| 2119 |
'default' => 'yes', |
| 2120 |
'condition' => [ |
| 2121 |
'show_terms_conditions' => 'yes', |
| 2122 |
], |
| 2123 |
] |
| 2124 |
); |
| 2125 |
|
| 2126 |
$this->end_controls_section(); |
| 2127 |
|
| 2128 |
// Redirect Settings (Legacy - for backward compatibility) |
| 2129 |
$this->start_controls_section( |
| 2130 |
'section_redirect', |
| 2131 |
[ |
| 2132 |
'label' => esc_html__('Redirect Settings', 'king-addons'), |
| 2133 |
] |
| 2134 |
); |
| 2135 |
|
| 2136 |
$this->add_control( |
| 2137 |
'redirect_info_notice', |
| 2138 |
[ |
| 2139 |
'type' => Controls_Manager::RAW_HTML, |
| 2140 |
'raw' => esc_html__('Note: Redirect settings have been moved to the "Register Actions" section above for better organization.', 'king-addons'), |
| 2141 |
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 2142 |
] |
| 2143 |
); |
| 2144 |
|
| 2145 |
$this->end_controls_section(); |
| 2146 |
|
| 2147 |
// Pro Features Section |
| 2148 |
\King_Addons\Core::renderProFeaturesSection($this, '', Controls_Manager::RAW_HTML, 'login-register-form', [ |
| 2149 |
'Custom Registration Fields (Text, Email, Phone, File Upload, Select, Checkbox, Radio)', |
| 2150 |
'Advanced Social Login (Google, Facebook with OAuth Setup)', |
| 2151 |
'Mailchimp Integration with Double Opt-in Support', |
| 2152 |
'Advanced Email Notifications (Custom Templates, Placeholders)', |
| 2153 |
'Admin Email Notifications for New Registrations', |
| 2154 |
'Email Template Customization with Placeholders', |
| 2155 |
'Enhanced Security Features (Rate Limiting, File Validation)', |
| 2156 |
'Advanced Redirect Options (Role-based Redirects)', |
| 2157 |
'User Role Assignment & Selection', |
| 2158 |
'Advanced Form Validation (Client & Server Side)', |
| 2159 |
'File Upload Security & Validation', |
| 2160 |
'reCAPTCHA v2/v3 Integration', |
| 2161 |
'Custom Fields User Meta Storage', |
| 2162 |
'Priority Support & Updates' |
| 2163 |
]); |
| 2164 |
|
| 2165 |
// Style Controls Start Here |
| 2166 |
$this->register_style_controls(); |
| 2167 |
} |
| 2168 |
|
| 2169 |
protected function register_style_controls() |
| 2170 |
{ |
| 2171 |
// Form Container Style |
| 2172 |
$this->start_controls_section( |
| 2173 |
'section_form_container_style', |
| 2174 |
[ |
| 2175 |
'label' => esc_html__('Form Container', 'king-addons'), |
| 2176 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2177 |
] |
| 2178 |
); |
| 2179 |
|
| 2180 |
$this->add_responsive_control( |
| 2181 |
'form_container_padding', |
| 2182 |
[ |
| 2183 |
'label' => esc_html__('Padding', 'king-addons'), |
| 2184 |
'type' => Controls_Manager::DIMENSIONS, |
| 2185 |
'size_units' => ['px', '%', 'em'], |
| 2186 |
'default' => [ |
| 2187 |
'top' => '30', |
| 2188 |
'right' => '30', |
| 2189 |
'bottom' => '30', |
| 2190 |
'left' => '30', |
| 2191 |
'unit' => 'px', |
| 2192 |
], |
| 2193 |
'selectors' => [ |
| 2194 |
'{{WRAPPER}} .king-addons-login-register-form' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2195 |
], |
| 2196 |
] |
| 2197 |
); |
| 2198 |
|
| 2199 |
$this->add_control( |
| 2200 |
'form_container_background', |
| 2201 |
[ |
| 2202 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 2203 |
'type' => Controls_Manager::COLOR, |
| 2204 |
'default' => '#ffffff', |
| 2205 |
'selectors' => [ |
| 2206 |
'{{WRAPPER}} .king-addons-login-register-form' => 'background-color: {{VALUE}};', |
| 2207 |
], |
| 2208 |
] |
| 2209 |
); |
| 2210 |
|
| 2211 |
$this->add_group_control( |
| 2212 |
Group_Control_Border::get_type(), |
| 2213 |
[ |
| 2214 |
'name' => 'form_container_border', |
| 2215 |
'label' => esc_html__('Border', 'king-addons'), |
| 2216 |
'selector' => '{{WRAPPER}} .king-addons-login-register-form', |
| 2217 |
'fields_options' => [ |
| 2218 |
'border' => [ |
| 2219 |
'default' => 'solid', |
| 2220 |
], |
| 2221 |
'width' => [ |
| 2222 |
'default' => [ |
| 2223 |
'top' => '1', |
| 2224 |
'right' => '1', |
| 2225 |
'bottom' => '1', |
| 2226 |
'left' => '1', |
| 2227 |
'unit' => 'px', |
| 2228 |
], |
| 2229 |
], |
| 2230 |
'color' => [ |
| 2231 |
'default' => '#e1e5e9', |
| 2232 |
], |
| 2233 |
], |
| 2234 |
] |
| 2235 |
); |
| 2236 |
|
| 2237 |
$this->add_control( |
| 2238 |
'form_container_border_radius', |
| 2239 |
[ |
| 2240 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 2241 |
'type' => Controls_Manager::DIMENSIONS, |
| 2242 |
'size_units' => ['px', '%'], |
| 2243 |
'default' => [ |
| 2244 |
'top' => '8', |
| 2245 |
'right' => '8', |
| 2246 |
'bottom' => '8', |
| 2247 |
'left' => '8', |
| 2248 |
'unit' => 'px', |
| 2249 |
], |
| 2250 |
'selectors' => [ |
| 2251 |
'{{WRAPPER}} .king-addons-login-register-form' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2252 |
], |
| 2253 |
] |
| 2254 |
); |
| 2255 |
|
| 2256 |
$this->add_group_control( |
| 2257 |
Group_Control_Box_Shadow::get_type(), |
| 2258 |
[ |
| 2259 |
'name' => 'form_container_box_shadow', |
| 2260 |
'label' => esc_html__('Box Shadow', 'king-addons'), |
| 2261 |
'selector' => '{{WRAPPER}} .king-addons-login-register-form', |
| 2262 |
'fields_options' => [ |
| 2263 |
'box_shadow_type' => [ |
| 2264 |
'default' => 'yes', |
| 2265 |
], |
| 2266 |
'box_shadow' => [ |
| 2267 |
'default' => [ |
| 2268 |
'horizontal' => 0, |
| 2269 |
'vertical' => 4, |
| 2270 |
'blur' => 20, |
| 2271 |
'spread' => 0, |
| 2272 |
'color' => 'rgba(0,0,0,0.1)', |
| 2273 |
], |
| 2274 |
], |
| 2275 |
], |
| 2276 |
] |
| 2277 |
); |
| 2278 |
|
| 2279 |
$this->end_controls_section(); |
| 2280 |
|
| 2281 |
// Form Title Style |
| 2282 |
$this->start_controls_section( |
| 2283 |
'section_form_title_style', |
| 2284 |
[ |
| 2285 |
'label' => esc_html__('Form Title', 'king-addons'), |
| 2286 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2287 |
] |
| 2288 |
); |
| 2289 |
|
| 2290 |
$this->add_group_control( |
| 2291 |
Group_Control_Typography::get_type(), |
| 2292 |
[ |
| 2293 |
'name' => 'form_title_typography', |
| 2294 |
'label' => esc_html__('Typography', 'king-addons'), |
| 2295 |
'selector' => '{{WRAPPER}} .king-addons-form-title', |
| 2296 |
] |
| 2297 |
); |
| 2298 |
|
| 2299 |
$this->add_control( |
| 2300 |
'form_title_color', |
| 2301 |
[ |
| 2302 |
'label' => esc_html__('Color', 'king-addons'), |
| 2303 |
'type' => Controls_Manager::COLOR, |
| 2304 |
'default' => '#333333', |
| 2305 |
'selectors' => [ |
| 2306 |
'{{WRAPPER}} .king-addons-form-title' => 'color: {{VALUE}};', |
| 2307 |
], |
| 2308 |
] |
| 2309 |
); |
| 2310 |
|
| 2311 |
$this->add_responsive_control( |
| 2312 |
'form_title_margin', |
| 2313 |
[ |
| 2314 |
'label' => esc_html__('Margin', 'king-addons'), |
| 2315 |
'type' => Controls_Manager::DIMENSIONS, |
| 2316 |
'size_units' => ['px', '%', 'em'], |
| 2317 |
'default' => [ |
| 2318 |
'top' => '0', |
| 2319 |
'right' => '0', |
| 2320 |
'bottom' => '10', |
| 2321 |
'left' => '0', |
| 2322 |
'unit' => 'px', |
| 2323 |
], |
| 2324 |
'selectors' => [ |
| 2325 |
'{{WRAPPER}} .king-addons-form-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2326 |
], |
| 2327 |
] |
| 2328 |
); |
| 2329 |
|
| 2330 |
$this->end_controls_section(); |
| 2331 |
|
| 2332 |
// Form Subtitle Style |
| 2333 |
$this->start_controls_section( |
| 2334 |
'section_form_subtitle_style', |
| 2335 |
[ |
| 2336 |
'label' => esc_html__('Form Subtitle', 'king-addons'), |
| 2337 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2338 |
] |
| 2339 |
); |
| 2340 |
|
| 2341 |
$this->add_group_control( |
| 2342 |
Group_Control_Typography::get_type(), |
| 2343 |
[ |
| 2344 |
'name' => 'form_subtitle_typography', |
| 2345 |
'label' => esc_html__('Typography', 'king-addons'), |
| 2346 |
'selector' => '{{WRAPPER}} .king-addons-form-subtitle', |
| 2347 |
] |
| 2348 |
); |
| 2349 |
|
| 2350 |
$this->add_control( |
| 2351 |
'form_subtitle_color', |
| 2352 |
[ |
| 2353 |
'label' => esc_html__('Color', 'king-addons'), |
| 2354 |
'type' => Controls_Manager::COLOR, |
| 2355 |
'default' => '#666666', |
| 2356 |
'selectors' => [ |
| 2357 |
'{{WRAPPER}} .king-addons-form-subtitle' => 'color: {{VALUE}};', |
| 2358 |
], |
| 2359 |
] |
| 2360 |
); |
| 2361 |
|
| 2362 |
$this->add_responsive_control( |
| 2363 |
'form_subtitle_margin', |
| 2364 |
[ |
| 2365 |
'label' => esc_html__('Margin', 'king-addons'), |
| 2366 |
'type' => Controls_Manager::DIMENSIONS, |
| 2367 |
'size_units' => ['px', '%', 'em'], |
| 2368 |
'default' => [ |
| 2369 |
'top' => '0', |
| 2370 |
'right' => '0', |
| 2371 |
'bottom' => '20', |
| 2372 |
'left' => '0', |
| 2373 |
'unit' => 'px', |
| 2374 |
], |
| 2375 |
'selectors' => [ |
| 2376 |
'{{WRAPPER}} .king-addons-form-subtitle' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2377 |
], |
| 2378 |
] |
| 2379 |
); |
| 2380 |
|
| 2381 |
$this->end_controls_section(); |
| 2382 |
|
| 2383 |
// Input Fields Style |
| 2384 |
$this->start_controls_section( |
| 2385 |
'section_input_fields_style', |
| 2386 |
[ |
| 2387 |
'label' => esc_html__('Input Fields', 'king-addons'), |
| 2388 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2389 |
] |
| 2390 |
); |
| 2391 |
|
| 2392 |
$this->add_group_control( |
| 2393 |
Group_Control_Typography::get_type(), |
| 2394 |
[ |
| 2395 |
'name' => 'input_fields_typography', |
| 2396 |
'label' => esc_html__('Typography', 'king-addons'), |
| 2397 |
'selector' => '{{WRAPPER}} .king-addons-form-field input', |
| 2398 |
] |
| 2399 |
); |
| 2400 |
|
| 2401 |
$this->add_control( |
| 2402 |
'input_fields_color', |
| 2403 |
[ |
| 2404 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 2405 |
'type' => Controls_Manager::COLOR, |
| 2406 |
'default' => '#333333', |
| 2407 |
'selectors' => [ |
| 2408 |
'{{WRAPPER}} .king-addons-form-field input' => 'color: {{VALUE}};', |
| 2409 |
], |
| 2410 |
] |
| 2411 |
); |
| 2412 |
|
| 2413 |
$this->add_control( |
| 2414 |
'input_fields_background', |
| 2415 |
[ |
| 2416 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 2417 |
'type' => Controls_Manager::COLOR, |
| 2418 |
'default' => '#ffffff', |
| 2419 |
'selectors' => [ |
| 2420 |
'{{WRAPPER}} .king-addons-form-field input' => 'background-color: {{VALUE}};', |
| 2421 |
], |
| 2422 |
] |
| 2423 |
); |
| 2424 |
|
| 2425 |
$this->add_responsive_control( |
| 2426 |
'input_fields_padding', |
| 2427 |
[ |
| 2428 |
'label' => esc_html__('Padding', 'king-addons'), |
| 2429 |
'type' => Controls_Manager::DIMENSIONS, |
| 2430 |
'size_units' => ['px', '%', 'em'], |
| 2431 |
'default' => [ |
| 2432 |
'top' => '12', |
| 2433 |
'right' => '15', |
| 2434 |
'bottom' => '12', |
| 2435 |
'left' => '15', |
| 2436 |
'unit' => 'px', |
| 2437 |
], |
| 2438 |
'selectors' => [ |
| 2439 |
'{{WRAPPER}} .king-addons-form-field input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2440 |
], |
| 2441 |
] |
| 2442 |
); |
| 2443 |
|
| 2444 |
$this->add_responsive_control( |
| 2445 |
'input_fields_margin', |
| 2446 |
[ |
| 2447 |
'label' => esc_html__('Margin', 'king-addons'), |
| 2448 |
'type' => Controls_Manager::DIMENSIONS, |
| 2449 |
'size_units' => ['px', '%', 'em'], |
| 2450 |
'default' => [ |
| 2451 |
'top' => '0', |
| 2452 |
'right' => '0', |
| 2453 |
'bottom' => '15', |
| 2454 |
'left' => '0', |
| 2455 |
'unit' => 'px', |
| 2456 |
], |
| 2457 |
'selectors' => [ |
| 2458 |
'{{WRAPPER}} .king-addons-form-field' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2459 |
], |
| 2460 |
] |
| 2461 |
); |
| 2462 |
|
| 2463 |
$this->add_group_control( |
| 2464 |
Group_Control_Border::get_type(), |
| 2465 |
[ |
| 2466 |
'name' => 'input_fields_border', |
| 2467 |
'label' => esc_html__('Border', 'king-addons'), |
| 2468 |
'selector' => '{{WRAPPER}} .king-addons-form-field input', |
| 2469 |
] |
| 2470 |
); |
| 2471 |
|
| 2472 |
$this->add_control( |
| 2473 |
'input_fields_border_radius', |
| 2474 |
[ |
| 2475 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 2476 |
'type' => Controls_Manager::DIMENSIONS, |
| 2477 |
'size_units' => ['px', '%'], |
| 2478 |
'default' => [ |
| 2479 |
'top' => '3', |
| 2480 |
'right' => '3', |
| 2481 |
'bottom' => '3', |
| 2482 |
'left' => '3', |
| 2483 |
'unit' => 'px', |
| 2484 |
], |
| 2485 |
'selectors' => [ |
| 2486 |
'{{WRAPPER}} .king-addons-form-field input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2487 |
], |
| 2488 |
] |
| 2489 |
); |
| 2490 |
|
| 2491 |
$this->add_control( |
| 2492 |
'input_fields_focus_color', |
| 2493 |
[ |
| 2494 |
'label' => esc_html__('Focus Border Color', 'king-addons'), |
| 2495 |
'type' => Controls_Manager::COLOR, |
| 2496 |
'default' => '#007cba', |
| 2497 |
'selectors' => [ |
| 2498 |
'{{WRAPPER}} .king-addons-form-field input:focus' => 'border-color: {{VALUE}};', |
| 2499 |
], |
| 2500 |
] |
| 2501 |
); |
| 2502 |
|
| 2503 |
$this->end_controls_section(); |
| 2504 |
|
| 2505 |
// Labels Style |
| 2506 |
$this->start_controls_section( |
| 2507 |
'section_labels_style', |
| 2508 |
[ |
| 2509 |
'label' => esc_html__('Labels', 'king-addons'), |
| 2510 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2511 |
'condition' => [ |
| 2512 |
'show_labels' => 'yes', |
| 2513 |
], |
| 2514 |
] |
| 2515 |
); |
| 2516 |
|
| 2517 |
$this->add_group_control( |
| 2518 |
Group_Control_Typography::get_type(), |
| 2519 |
[ |
| 2520 |
'name' => 'labels_typography', |
| 2521 |
'label' => esc_html__('Typography', 'king-addons'), |
| 2522 |
'selector' => '{{WRAPPER}} .king-addons-form-field label', |
| 2523 |
] |
| 2524 |
); |
| 2525 |
|
| 2526 |
$this->add_control( |
| 2527 |
'labels_color', |
| 2528 |
[ |
| 2529 |
'label' => esc_html__('Color', 'king-addons'), |
| 2530 |
'type' => Controls_Manager::COLOR, |
| 2531 |
'default' => '#333333', |
| 2532 |
'selectors' => [ |
| 2533 |
'{{WRAPPER}} .king-addons-form-field label' => 'color: {{VALUE}};', |
| 2534 |
], |
| 2535 |
] |
| 2536 |
); |
| 2537 |
|
| 2538 |
$this->add_responsive_control( |
| 2539 |
'labels_margin', |
| 2540 |
[ |
| 2541 |
'label' => esc_html__('Margin', 'king-addons'), |
| 2542 |
'type' => Controls_Manager::DIMENSIONS, |
| 2543 |
'size_units' => ['px', '%', 'em'], |
| 2544 |
'default' => [ |
| 2545 |
'top' => '0', |
| 2546 |
'right' => '0', |
| 2547 |
'bottom' => '5', |
| 2548 |
'left' => '0', |
| 2549 |
'unit' => 'px', |
| 2550 |
], |
| 2551 |
'selectors' => [ |
| 2552 |
'{{WRAPPER}} .king-addons-form-field label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2553 |
], |
| 2554 |
] |
| 2555 |
); |
| 2556 |
|
| 2557 |
$this->end_controls_section(); |
| 2558 |
|
| 2559 |
// Button Style |
| 2560 |
$this->start_controls_section( |
| 2561 |
'section_button_style', |
| 2562 |
[ |
| 2563 |
'label' => esc_html__('Buttons', 'king-addons'), |
| 2564 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2565 |
] |
| 2566 |
); |
| 2567 |
|
| 2568 |
$this->add_group_control( |
| 2569 |
Group_Control_Typography::get_type(), |
| 2570 |
[ |
| 2571 |
'name' => 'button_typography', |
| 2572 |
'label' => esc_html__('Typography', 'king-addons'), |
| 2573 |
'selector' => '{{WRAPPER}} .king-addons-form-button', |
| 2574 |
] |
| 2575 |
); |
| 2576 |
|
| 2577 |
$this->start_controls_tabs('button_style_tabs'); |
| 2578 |
|
| 2579 |
$this->start_controls_tab( |
| 2580 |
'button_normal_tab', |
| 2581 |
[ |
| 2582 |
'label' => esc_html__('Normal', 'king-addons'), |
| 2583 |
] |
| 2584 |
); |
| 2585 |
|
| 2586 |
$this->add_control( |
| 2587 |
'button_color', |
| 2588 |
[ |
| 2589 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 2590 |
'type' => Controls_Manager::COLOR, |
| 2591 |
'default' => '#ffffff', |
| 2592 |
'selectors' => [ |
| 2593 |
'{{WRAPPER}} .king-addons-form-button' => 'color: {{VALUE}};', |
| 2594 |
], |
| 2595 |
] |
| 2596 |
); |
| 2597 |
|
| 2598 |
$this->add_control( |
| 2599 |
'button_background', |
| 2600 |
[ |
| 2601 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 2602 |
'type' => Controls_Manager::COLOR, |
| 2603 |
'default' => '#007cba', |
| 2604 |
'selectors' => [ |
| 2605 |
'{{WRAPPER}} .king-addons-form-button' => 'background-color: {{VALUE}};', |
| 2606 |
], |
| 2607 |
] |
| 2608 |
); |
| 2609 |
|
| 2610 |
$this->end_controls_tab(); |
| 2611 |
|
| 2612 |
$this->start_controls_tab( |
| 2613 |
'button_hover_tab', |
| 2614 |
[ |
| 2615 |
'label' => esc_html__('Hover', 'king-addons'), |
| 2616 |
] |
| 2617 |
); |
| 2618 |
|
| 2619 |
$this->add_control( |
| 2620 |
'button_hover_color', |
| 2621 |
[ |
| 2622 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 2623 |
'type' => Controls_Manager::COLOR, |
| 2624 |
'default' => '#ffffff', |
| 2625 |
'selectors' => [ |
| 2626 |
'{{WRAPPER}} .king-addons-form-button:hover' => 'color: {{VALUE}};', |
| 2627 |
], |
| 2628 |
] |
| 2629 |
); |
| 2630 |
|
| 2631 |
$this->add_control( |
| 2632 |
'button_hover_background', |
| 2633 |
[ |
| 2634 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 2635 |
'type' => Controls_Manager::COLOR, |
| 2636 |
'default' => '#005a87', |
| 2637 |
'selectors' => [ |
| 2638 |
'{{WRAPPER}} .king-addons-form-button:hover' => 'background-color: {{VALUE}};', |
| 2639 |
], |
| 2640 |
] |
| 2641 |
); |
| 2642 |
|
| 2643 |
$this->end_controls_tab(); |
| 2644 |
|
| 2645 |
$this->end_controls_tabs(); |
| 2646 |
|
| 2647 |
$this->add_responsive_control( |
| 2648 |
'button_padding', |
| 2649 |
[ |
| 2650 |
'label' => esc_html__('Padding', 'king-addons'), |
| 2651 |
'type' => Controls_Manager::DIMENSIONS, |
| 2652 |
'size_units' => ['px', '%', 'em'], |
| 2653 |
'default' => [ |
| 2654 |
'top' => '12', |
| 2655 |
'right' => '30', |
| 2656 |
'bottom' => '12', |
| 2657 |
'left' => '30', |
| 2658 |
'unit' => 'px', |
| 2659 |
], |
| 2660 |
'selectors' => [ |
| 2661 |
'{{WRAPPER}} .king-addons-form-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2662 |
], |
| 2663 |
'separator' => 'before', |
| 2664 |
] |
| 2665 |
); |
| 2666 |
|
| 2667 |
$this->add_responsive_control( |
| 2668 |
'button_margin', |
| 2669 |
[ |
| 2670 |
'label' => esc_html__('Margin', 'king-addons'), |
| 2671 |
'type' => Controls_Manager::DIMENSIONS, |
| 2672 |
'size_units' => ['px', '%', 'em'], |
| 2673 |
'default' => [ |
| 2674 |
'top' => '10', |
| 2675 |
'right' => '0', |
| 2676 |
'bottom' => '15', |
| 2677 |
'left' => '0', |
| 2678 |
'unit' => 'px', |
| 2679 |
], |
| 2680 |
'selectors' => [ |
| 2681 |
'{{WRAPPER}} .king-addons-form-button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2682 |
], |
| 2683 |
] |
| 2684 |
); |
| 2685 |
|
| 2686 |
$this->add_group_control( |
| 2687 |
Group_Control_Border::get_type(), |
| 2688 |
[ |
| 2689 |
'name' => 'button_border', |
| 2690 |
'label' => esc_html__('Border', 'king-addons'), |
| 2691 |
'selector' => '{{WRAPPER}} .king-addons-form-button', |
| 2692 |
] |
| 2693 |
); |
| 2694 |
|
| 2695 |
$this->add_control( |
| 2696 |
'button_border_radius', |
| 2697 |
[ |
| 2698 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 2699 |
'type' => Controls_Manager::DIMENSIONS, |
| 2700 |
'size_units' => ['px', '%'], |
| 2701 |
'default' => [ |
| 2702 |
'top' => '3', |
| 2703 |
'right' => '3', |
| 2704 |
'bottom' => '3', |
| 2705 |
'left' => '3', |
| 2706 |
'unit' => 'px', |
| 2707 |
], |
| 2708 |
'selectors' => [ |
| 2709 |
'{{WRAPPER}} .king-addons-form-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2710 |
], |
| 2711 |
] |
| 2712 |
); |
| 2713 |
|
| 2714 |
$this->add_responsive_control( |
| 2715 |
'button_width', |
| 2716 |
[ |
| 2717 |
'label' => esc_html__('Width', 'king-addons'), |
| 2718 |
'type' => Controls_Manager::SLIDER, |
| 2719 |
'size_units' => ['px', '%'], |
| 2720 |
'range' => [ |
| 2721 |
'px' => [ |
| 2722 |
'min' => 0, |
| 2723 |
'max' => 1000, |
| 2724 |
], |
| 2725 |
'%' => [ |
| 2726 |
'min' => 0, |
| 2727 |
'max' => 100, |
| 2728 |
], |
| 2729 |
], |
| 2730 |
'default' => [ |
| 2731 |
'unit' => '%', |
| 2732 |
'size' => 100, |
| 2733 |
], |
| 2734 |
'selectors' => [ |
| 2735 |
'{{WRAPPER}} .king-addons-form-button' => 'width: {{SIZE}}{{UNIT}};', |
| 2736 |
], |
| 2737 |
] |
| 2738 |
); |
| 2739 |
|
| 2740 |
$this->end_controls_section(); |
| 2741 |
|
| 2742 |
// Links Style |
| 2743 |
$this->start_controls_section( |
| 2744 |
'section_links_style', |
| 2745 |
[ |
| 2746 |
'label' => esc_html__('Links', 'king-addons'), |
| 2747 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2748 |
] |
| 2749 |
); |
| 2750 |
|
| 2751 |
$this->add_group_control( |
| 2752 |
Group_Control_Typography::get_type(), |
| 2753 |
[ |
| 2754 |
'name' => 'links_typography', |
| 2755 |
'label' => esc_html__('Typography', 'king-addons'), |
| 2756 |
'selector' => '{{WRAPPER}} .king-addons-form-link, {{WRAPPER}} .king-addons-form-toggle', |
| 2757 |
] |
| 2758 |
); |
| 2759 |
|
| 2760 |
$this->start_controls_tabs('links_style_tabs'); |
| 2761 |
|
| 2762 |
$this->start_controls_tab( |
| 2763 |
'links_normal_tab', |
| 2764 |
[ |
| 2765 |
'label' => esc_html__('Normal', 'king-addons'), |
| 2766 |
] |
| 2767 |
); |
| 2768 |
|
| 2769 |
$this->add_control( |
| 2770 |
'links_color', |
| 2771 |
[ |
| 2772 |
'label' => esc_html__('Color', 'king-addons'), |
| 2773 |
'type' => Controls_Manager::COLOR, |
| 2774 |
'default' => '#007cba', |
| 2775 |
'selectors' => [ |
| 2776 |
'{{WRAPPER}} .king-addons-form-link, {{WRAPPER}} .king-addons-form-toggle' => 'color: {{VALUE}};', |
| 2777 |
], |
| 2778 |
] |
| 2779 |
); |
| 2780 |
|
| 2781 |
$this->end_controls_tab(); |
| 2782 |
|
| 2783 |
$this->start_controls_tab( |
| 2784 |
'links_hover_tab', |
| 2785 |
[ |
| 2786 |
'label' => esc_html__('Hover', 'king-addons'), |
| 2787 |
] |
| 2788 |
); |
| 2789 |
|
| 2790 |
$this->add_control( |
| 2791 |
'links_hover_color', |
| 2792 |
[ |
| 2793 |
'label' => esc_html__('Color', 'king-addons'), |
| 2794 |
'type' => Controls_Manager::COLOR, |
| 2795 |
'default' => '#005a87', |
| 2796 |
'selectors' => [ |
| 2797 |
'{{WRAPPER}} .king-addons-form-link:hover, {{WRAPPER}} .king-addons-form-toggle:hover' => 'color: {{VALUE}};', |
| 2798 |
], |
| 2799 |
] |
| 2800 |
); |
| 2801 |
|
| 2802 |
$this->end_controls_tab(); |
| 2803 |
|
| 2804 |
$this->end_controls_tabs(); |
| 2805 |
|
| 2806 |
$this->add_responsive_control( |
| 2807 |
'links_margin', |
| 2808 |
[ |
| 2809 |
'label' => esc_html__('Margin', 'king-addons'), |
| 2810 |
'type' => Controls_Manager::DIMENSIONS, |
| 2811 |
'size_units' => ['px', '%', 'em'], |
| 2812 |
'default' => [ |
| 2813 |
'top' => '10', |
| 2814 |
'right' => '0', |
| 2815 |
'bottom' => '0', |
| 2816 |
'left' => '0', |
| 2817 |
'unit' => 'px', |
| 2818 |
], |
| 2819 |
'selectors' => [ |
| 2820 |
'{{WRAPPER}} .king-addons-form-link, {{WRAPPER}} .king-addons-form-toggle' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2821 |
], |
| 2822 |
'separator' => 'before', |
| 2823 |
] |
| 2824 |
); |
| 2825 |
|
| 2826 |
$this->end_controls_section(); |
| 2827 |
|
| 2828 |
// Messages Style |
| 2829 |
$this->start_controls_section( |
| 2830 |
'section_messages_style', |
| 2831 |
[ |
| 2832 |
'label' => esc_html__('Messages', 'king-addons'), |
| 2833 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2834 |
] |
| 2835 |
); |
| 2836 |
|
| 2837 |
$this->add_group_control( |
| 2838 |
Group_Control_Typography::get_type(), |
| 2839 |
[ |
| 2840 |
'name' => 'messages_typography', |
| 2841 |
'label' => esc_html__('Typography', 'king-addons'), |
| 2842 |
'selector' => '{{WRAPPER}} .king-addons-form-message', |
| 2843 |
] |
| 2844 |
); |
| 2845 |
|
| 2846 |
$this->add_control( |
| 2847 |
'success_message_color', |
| 2848 |
[ |
| 2849 |
'label' => esc_html__('Success Message Color', 'king-addons'), |
| 2850 |
'type' => Controls_Manager::COLOR, |
| 2851 |
'default' => '#4caf50', |
| 2852 |
'selectors' => [ |
| 2853 |
'{{WRAPPER}} .king-addons-form-message.success' => 'color: {{VALUE}};', |
| 2854 |
], |
| 2855 |
] |
| 2856 |
); |
| 2857 |
|
| 2858 |
$this->add_control( |
| 2859 |
'error_message_color', |
| 2860 |
[ |
| 2861 |
'label' => esc_html__('Error Message Color', 'king-addons'), |
| 2862 |
'type' => Controls_Manager::COLOR, |
| 2863 |
'default' => '#f44336', |
| 2864 |
'selectors' => [ |
| 2865 |
'{{WRAPPER}} .king-addons-form-message.error' => 'color: {{VALUE}};', |
| 2866 |
], |
| 2867 |
] |
| 2868 |
); |
| 2869 |
|
| 2870 |
$this->add_responsive_control( |
| 2871 |
'messages_padding', |
| 2872 |
[ |
| 2873 |
'label' => esc_html__('Padding', 'king-addons'), |
| 2874 |
'type' => Controls_Manager::DIMENSIONS, |
| 2875 |
'size_units' => ['px', '%', 'em'], |
| 2876 |
'default' => [ |
| 2877 |
'top' => '10', |
| 2878 |
'right' => '15', |
| 2879 |
'bottom' => '10', |
| 2880 |
'left' => '15', |
| 2881 |
'unit' => 'px', |
| 2882 |
], |
| 2883 |
'selectors' => [ |
| 2884 |
'{{WRAPPER}} .king-addons-form-message' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2885 |
], |
| 2886 |
] |
| 2887 |
); |
| 2888 |
|
| 2889 |
$this->add_responsive_control( |
| 2890 |
'messages_margin', |
| 2891 |
[ |
| 2892 |
'label' => esc_html__('Margin', 'king-addons'), |
| 2893 |
'type' => Controls_Manager::DIMENSIONS, |
| 2894 |
'size_units' => ['px', '%', 'em'], |
| 2895 |
'default' => [ |
| 2896 |
'top' => '0', |
| 2897 |
'right' => '0', |
| 2898 |
'bottom' => '15', |
| 2899 |
'left' => '0', |
| 2900 |
'unit' => 'px', |
| 2901 |
], |
| 2902 |
'selectors' => [ |
| 2903 |
'{{WRAPPER}} .king-addons-form-message' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2904 |
], |
| 2905 |
] |
| 2906 |
); |
| 2907 |
|
| 2908 |
$this->add_control( |
| 2909 |
'messages_border_radius', |
| 2910 |
[ |
| 2911 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 2912 |
'type' => Controls_Manager::DIMENSIONS, |
| 2913 |
'size_units' => ['px', '%'], |
| 2914 |
'default' => [ |
| 2915 |
'top' => '3', |
| 2916 |
'right' => '3', |
| 2917 |
'bottom' => '3', |
| 2918 |
'left' => '3', |
| 2919 |
'unit' => 'px', |
| 2920 |
], |
| 2921 |
'selectors' => [ |
| 2922 |
'{{WRAPPER}} .king-addons-form-message' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2923 |
], |
| 2924 |
] |
| 2925 |
); |
| 2926 |
|
| 2927 |
$this->end_controls_section(); |
| 2928 |
} |
| 2929 |
|
| 2930 |
protected function render() |
| 2931 |
{ |
| 2932 |
$settings = $this->get_settings_for_display(); |
| 2933 |
|
| 2934 |
if (king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 2935 |
$this->render_pro($settings); |
| 2936 |
} else { |
| 2937 |
$this->render_free($settings); |
| 2938 |
} |
| 2939 |
} |
| 2940 |
|
| 2941 |
/** |
| 2942 |
* Render Pro version with all features |
| 2943 |
*/ |
| 2944 |
private function render_pro($settings) |
| 2945 |
{ |
| 2946 |
// Full implementation with all features |
| 2947 |
$this->render_full_form($settings); |
| 2948 |
} |
| 2949 |
|
| 2950 |
/** |
| 2951 |
* Render Free version with limited features |
| 2952 |
*/ |
| 2953 |
private function render_free($settings) |
| 2954 |
{ |
| 2955 |
// Disable premium features for free users |
| 2956 |
$settings['custom_fields'] = []; // No custom fields in free |
| 2957 |
$settings['enable_social_login'] = 'no'; // No social login in free |
| 2958 |
$settings['enable_mailchimp_integration'] = 'no'; // No Mailchimp in free |
| 2959 |
$settings['enable_admin_email'] = 'no'; // No admin emails in free |
| 2960 |
|
| 2961 |
// Render with limited settings |
| 2962 |
$this->render_full_form($settings); |
| 2963 |
|
| 2964 |
// Show upgrade notice if premium features are attempted |
| 2965 |
if ($this->get_settings('enable_social_login') === 'yes' || |
| 2966 |
$this->get_settings('enable_mailchimp_integration') === 'yes' || |
| 2967 |
!empty($this->get_settings('custom_fields'))) { |
| 2968 |
?> |
| 2969 |
<div class="king-addons-pro-notice-widget" style="text-align: center; padding: 20px; background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; margin: 10px 0;"> |
| 2970 |
<h4 style="margin: 0 0 10px 0; color: #495057;">🔒 Premium Features Detected</h4> |
| 2971 |
<p style="margin: 0 0 15px 0; color: #6c757d;">You have configured premium features that require King Addons Pro.</p> |
| 2972 |
<a href="https://kingaddons.com/pricing/?utm_source=kng-widget-login-register-form-frontend-upgrade-pro&utm_medium=widget&utm_campaign=kng" |
| 2973 |
target="_blank" |
| 2974 |
style="display: inline-block; padding: 10px 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; text-decoration: none; border-radius: 5px; font-weight: 500;"> |
| 2975 |
Upgrade to Pro |
| 2976 |
</a> |
| 2977 |
</div> |
| 2978 |
<?php |
| 2979 |
} |
| 2980 |
} |
| 2981 |
|
| 2982 |
/** |
| 2983 |
* Full form rendering (used by both free and pro) |
| 2984 |
*/ |
| 2985 |
private function render_full_form($settings) |
| 2986 |
{ |
| 2987 |
$widget_id = $this->get_id(); |
| 2988 |
$default_form = $settings['default_form_type']; |
| 2989 |
$enable_ajax = $settings['enable_ajax'] === 'yes'; |
| 2990 |
$show_labels = $settings['show_labels'] === 'yes'; |
| 2991 |
|
| 2992 |
// Check if user registration is enabled |
| 2993 |
$user_can_register = get_option('users_can_register'); |
| 2994 |
|
| 2995 |
// Check if user is already logged in and should be redirected |
| 2996 |
if (is_user_logged_in() && $settings['redirect_logout_user'] === 'yes' && !empty($settings['redirect_logout_url']['url'])) { |
| 2997 |
$redirect_url = $settings['redirect_logout_url']['url']; |
| 2998 |
?> |
| 2999 |
<script> |
| 3000 |
window.location.href = '<?php echo esc_js($redirect_url); ?>'; |
| 3001 |
</script> |
| 3002 |
<?php |
| 3003 |
return; |
| 3004 |
} |
| 3005 |
|
| 3006 |
// Enqueue reCAPTCHA API if enabled |
| 3007 |
if ($settings['enable_recaptcha'] === 'yes' && !empty($settings['recaptcha_site_key'])) { |
| 3008 |
$recaptcha_url = 'https://www.google.com/recaptcha/api.js'; |
| 3009 |
if ($settings['recaptcha_version'] === 'v3') { |
| 3010 |
$recaptcha_url .= '?render=' . $settings['recaptcha_site_key']; |
| 3011 |
} |
| 3012 |
wp_enqueue_script('google-recaptcha', $recaptcha_url, [], null, true); |
| 3013 |
} |
| 3014 |
|
| 3015 |
// Enqueue Social Login APIs if enabled |
| 3016 |
if ($settings['enable_social_login'] === 'yes') { |
| 3017 |
// Google Sign-In API |
| 3018 |
if ($settings['enable_google_login'] === 'yes' && !empty($settings['google_client_id'])) { |
| 3019 |
wp_enqueue_script('google-signin-api', 'https://accounts.google.com/gsi/client', [], null, true); |
| 3020 |
} |
| 3021 |
|
| 3022 |
// Facebook SDK |
| 3023 |
if ($settings['enable_facebook_login'] === 'yes' && !empty($settings['facebook_app_id'])) { |
| 3024 |
$fb_app_id = $settings['facebook_app_id']; |
| 3025 |
$fb_script = " |
| 3026 |
window.fbAsyncInit = function() { |
| 3027 |
FB.init({ |
| 3028 |
appId: '{$fb_app_id}', |
| 3029 |
cookie: true, |
| 3030 |
xfbml: true, |
| 3031 |
version: 'v18.0' |
| 3032 |
}); |
| 3033 |
}; |
| 3034 |
(function(d, s, id){ |
| 3035 |
var js, fjs = d.getElementsByTagName(s)[0]; |
| 3036 |
if (d.getElementById(id)) {return;} |
| 3037 |
js = d.createElement(s); js.id = id; |
| 3038 |
js.src = 'https://connect.facebook.net/en_US/sdk.js'; |
| 3039 |
fjs.parentNode.insertBefore(js, fjs); |
| 3040 |
}(document, 'script', 'facebook-jssdk')); |
| 3041 |
"; |
| 3042 |
wp_add_inline_script('king-addons-login-register-form-script', $fb_script); |
| 3043 |
} |
| 3044 |
} |
| 3045 |
|
| 3046 |
// AJAX handlers are now registered in constructor |
| 3047 |
|
| 3048 |
?> |
| 3049 |
<div class="king-addons-login-register-form-wrapper" |
| 3050 |
data-widget-id="<?php echo esc_attr($widget_id); ?>" |
| 3051 |
data-ajax="<?php echo $enable_ajax ? 'true' : 'false'; ?>" |
| 3052 |
data-recaptcha-secret-key="<?php echo esc_attr($settings['recaptcha_secret_key'] ?? ''); ?>" |
| 3053 |
data-recaptcha-threshold="<?php echo esc_attr($settings['recaptcha_score_threshold']['size'] ?? '0.5'); ?>" |
| 3054 |
data-redirect-login="<?php echo esc_attr($settings['redirect_after_login']['url'] ?? ''); ?>" |
| 3055 |
data-redirect-register="<?php echo esc_attr($settings['redirect_after_register']['url'] ?? ''); ?>" |
| 3056 |
data-terms-required="<?php echo esc_attr($settings['terms_required'] ?? 'no'); ?>" |
| 3057 |
data-enable-user-email="<?php echo esc_attr($settings['enable_user_email'] ?? 'yes'); ?>" |
| 3058 |
data-user-email-subject="<?php echo esc_attr($settings['user_email_subject'] ?? ''); ?>" |
| 3059 |
data-user-email-content="<?php echo esc_attr($settings['user_email_content'] ?? ''); ?>" |
| 3060 |
data-enable-admin-email="<?php echo esc_attr($settings['enable_admin_email'] ?? 'no'); ?>" |
| 3061 |
data-admin-email-address="<?php echo esc_attr($settings['admin_email_address'] ?? ''); ?>" |
| 3062 |
data-admin-email-subject="<?php echo esc_attr($settings['admin_email_subject'] ?? ''); ?>" |
| 3063 |
data-admin-email-content="<?php echo esc_attr($settings['admin_email_content'] ?? ''); ?>" |
| 3064 |
data-enable-mailchimp="<?php echo esc_attr($settings['enable_mailchimp_integration'] ?? 'no'); ?>" |
| 3065 |
data-mailchimp-api-key="<?php echo esc_attr($settings['mailchimp_api_key'] ?? ''); ?>" |
| 3066 |
data-mailchimp-list-id="<?php echo esc_attr($settings['mailchimp_list_id'] ?? ''); ?>" |
| 3067 |
data-mailchimp-double-optin="<?php echo esc_attr($settings['mailchimp_double_optin'] ?? 'no'); ?>" |
| 3068 |
data-enable-social-login="<?php echo esc_attr($settings['enable_social_login'] ?? 'no'); ?>" |
| 3069 |
data-google-client-id="<?php echo esc_attr($settings['google_client_id'] ?? ''); ?>" |
| 3070 |
data-google-client-secret="<?php echo esc_attr($settings['google_client_secret'] ?? ''); ?>" |
| 3071 |
data-facebook-app-id="<?php echo esc_attr($settings['facebook_app_id'] ?? ''); ?>" |
| 3072 |
data-facebook-app-secret="<?php echo esc_attr($settings['facebook_app_secret'] ?? ''); ?>" |
| 3073 |
data-auto-login="<?php echo esc_attr($settings['auto_login_after_register'] ?? 'yes'); ?>"> |
| 3074 |
|
| 3075 |
<!-- Form Messages Container --> |
| 3076 |
<div class="king-addons-form-message" style="display: none;"></div> |
| 3077 |
|
| 3078 |
<?php $this->render_form_header($settings); ?> |
| 3079 |
|
| 3080 |
<!-- Login Form --> |
| 3081 |
<div class="king-addons-login-register-form king-addons-login-form <?php echo $default_form === 'register' ? 'king-addons-form-hidden' : ''; ?>" |
| 3082 |
id="king-addons-login-form-<?php echo esc_attr($widget_id); ?>"> |
| 3083 |
|
| 3084 |
<?php if (!empty($settings['login_form_title'])): ?> |
| 3085 |
<h3 class="king-addons-form-title"><?php echo esc_html($settings['login_form_title']); ?></h3> |
| 3086 |
<?php endif; ?> |
| 3087 |
|
| 3088 |
<?php if (!empty($settings['login_form_subtitle'])): ?> |
| 3089 |
<p class="king-addons-form-subtitle"><?php echo esc_html($settings['login_form_subtitle']); ?></p> |
| 3090 |
<?php endif; ?> |
| 3091 |
|
| 3092 |
<div class="king-addons-form-message"></div> |
| 3093 |
|
| 3094 |
<form class="king-addons-form" method="post"> |
| 3095 |
<?php wp_nonce_field('king_addons_login_action', 'king_addons_login_nonce'); ?> |
| 3096 |
|
| 3097 |
<div class="king-addons-form-field"> |
| 3098 |
<?php if ($show_labels && !empty($settings['login_username_label'])): ?> |
| 3099 |
<label for="king-addons-login-username-<?php echo esc_attr($widget_id); ?>"> |
| 3100 |
<?php echo esc_html($settings['login_username_label']); ?> |
| 3101 |
</label> |
| 3102 |
<?php endif; ?> |
| 3103 |
<input type="text" |
| 3104 |
id="king-addons-login-username-<?php echo esc_attr($widget_id); ?>" |
| 3105 |
name="username" |
| 3106 |
placeholder="<?php echo esc_attr($settings['login_username_placeholder']); ?>" |
| 3107 |
required> |
| 3108 |
</div> |
| 3109 |
|
| 3110 |
<div class="king-addons-form-field <?php echo $settings['show_password_visibility_login'] === 'yes' ? 'king-addons-password-field' : ''; ?>"> |
| 3111 |
<?php if ($show_labels && !empty($settings['login_password_label'])): ?> |
| 3112 |
<label for="king-addons-login-password-<?php echo esc_attr($widget_id); ?>"> |
| 3113 |
<?php echo esc_html($settings['login_password_label']); ?> |
| 3114 |
</label> |
| 3115 |
<?php endif; ?> |
| 3116 |
<div class="king-addons-password-input-wrapper"> |
| 3117 |
<input type="password" |
| 3118 |
id="king-addons-login-password-<?php echo esc_attr($widget_id); ?>" |
| 3119 |
name="password" |
| 3120 |
placeholder="<?php echo esc_attr($settings['login_password_placeholder']); ?>" |
| 3121 |
required> |
| 3122 |
<?php if ($settings['show_password_visibility_login'] === 'yes'): ?> |
| 3123 |
<button type="button" class="king-addons-password-toggle" aria-label="Toggle password visibility"> |
| 3124 |
<span class="king-addons-password-toggle-icon">👁</span> |
| 3125 |
</button> |
| 3126 |
<?php endif; ?> |
| 3127 |
</div> |
| 3128 |
</div> |
| 3129 |
|
| 3130 |
<?php if ($settings['show_remember_me'] === 'yes'): ?> |
| 3131 |
<div class="king-addons-form-field king-addons-checkbox-field"> |
| 3132 |
<label> |
| 3133 |
<input type="checkbox" name="remember" value="1"> |
| 3134 |
<?php echo esc_html($settings['remember_me_text']); ?> |
| 3135 |
</label> |
| 3136 |
</div> |
| 3137 |
<?php endif; ?> |
| 3138 |
|
| 3139 |
<?php $this->render_recaptcha($settings, 'login'); ?> |
| 3140 |
|
| 3141 |
<div class="king-addons-form-field"> |
| 3142 |
<button type="submit" class="king-addons-form-button king-addons-login-button"> |
| 3143 |
<?php echo esc_html($settings['login_button_text']); ?> |
| 3144 |
</button> |
| 3145 |
</div> |
| 3146 |
|
| 3147 |
<div class="king-addons-form-links"> |
| 3148 |
<?php if ($settings['show_lost_password_link'] === 'yes'): ?> |
| 3149 |
<span class="king-addons-form-toggle" data-toggle="lostpassword"> |
| 3150 |
<?php echo esc_html($settings['lost_password_link_text']); ?> |
| 3151 |
</span> |
| 3152 |
<?php endif; ?> |
| 3153 |
|
| 3154 |
<?php if ($user_can_register && $settings['show_register_link'] === 'yes'): ?> |
| 3155 |
<span class="king-addons-form-toggle" data-toggle="register"> |
| 3156 |
<?php echo esc_html($settings['register_link_text']); ?> |
| 3157 |
</span> |
| 3158 |
<?php endif; ?> |
| 3159 |
</div> |
| 3160 |
</form> |
| 3161 |
|
| 3162 |
<?php $this->render_social_login($settings, 'login'); ?> |
| 3163 |
</div> |
| 3164 |
|
| 3165 |
<!-- Register Form --> |
| 3166 |
<?php if ($user_can_register): ?> |
| 3167 |
<div class="king-addons-login-register-form king-addons-register-form <?php echo $default_form === 'login' ? 'king-addons-form-hidden' : ''; ?>" |
| 3168 |
id="king-addons-register-form-<?php echo esc_attr($widget_id); ?>"> |
| 3169 |
|
| 3170 |
<?php if (!empty($settings['register_form_title'])): ?> |
| 3171 |
<h3 class="king-addons-form-title"><?php echo esc_html($settings['register_form_title']); ?></h3> |
| 3172 |
<?php endif; ?> |
| 3173 |
|
| 3174 |
<?php if (!empty($settings['register_form_subtitle'])): ?> |
| 3175 |
<p class="king-addons-form-subtitle"><?php echo esc_html($settings['register_form_subtitle']); ?></p> |
| 3176 |
<?php endif; ?> |
| 3177 |
|
| 3178 |
<div class="king-addons-form-message"></div> |
| 3179 |
|
| 3180 |
<form class="king-addons-form" method="post"> |
| 3181 |
<?php wp_nonce_field('king_addons_register_action', 'king_addons_register_nonce'); ?> |
| 3182 |
|
| 3183 |
<?php if ($settings['show_first_name'] === 'yes'): ?> |
| 3184 |
<div class="king-addons-form-field"> |
| 3185 |
<?php if ($show_labels && !empty($settings['register_first_name_label'])): ?> |
| 3186 |
<label for="king-addons-register-first-name-<?php echo esc_attr($widget_id); ?>"> |
| 3187 |
<?php echo esc_html($settings['register_first_name_label']); ?> |
| 3188 |
</label> |
| 3189 |
<?php endif; ?> |
| 3190 |
<input type="text" |
| 3191 |
id="king-addons-register-first-name-<?php echo esc_attr($widget_id); ?>" |
| 3192 |
name="first_name" |
| 3193 |
placeholder="<?php echo esc_attr($settings['register_first_name_placeholder']); ?>"> |
| 3194 |
</div> |
| 3195 |
<?php endif; ?> |
| 3196 |
|
| 3197 |
<?php if ($settings['show_last_name'] === 'yes'): ?> |
| 3198 |
<div class="king-addons-form-field"> |
| 3199 |
<?php if ($show_labels && !empty($settings['register_last_name_label'])): ?> |
| 3200 |
<label for="king-addons-register-last-name-<?php echo esc_attr($widget_id); ?>"> |
| 3201 |
<?php echo esc_html($settings['register_last_name_label']); ?> |
| 3202 |
</label> |
| 3203 |
<?php endif; ?> |
| 3204 |
<input type="text" |
| 3205 |
id="king-addons-register-last-name-<?php echo esc_attr($widget_id); ?>" |
| 3206 |
name="last_name" |
| 3207 |
placeholder="<?php echo esc_attr($settings['register_last_name_placeholder']); ?>"> |
| 3208 |
</div> |
| 3209 |
<?php endif; ?> |
| 3210 |
|
| 3211 |
<div class="king-addons-form-field"> |
| 3212 |
<?php if ($show_labels && !empty($settings['register_email_label'])): ?> |
| 3213 |
<label for="king-addons-register-email-<?php echo esc_attr($widget_id); ?>"> |
| 3214 |
<?php echo esc_html($settings['register_email_label']); ?> |
| 3215 |
</label> |
| 3216 |
<?php endif; ?> |
| 3217 |
<input type="email" |
| 3218 |
id="king-addons-register-email-<?php echo esc_attr($widget_id); ?>" |
| 3219 |
name="email" |
| 3220 |
placeholder="<?php echo esc_attr($settings['register_email_placeholder']); ?>" |
| 3221 |
required> |
| 3222 |
</div> |
| 3223 |
|
| 3224 |
<div class="king-addons-form-field"> |
| 3225 |
<?php if ($show_labels && !empty($settings['register_username_label'])): ?> |
| 3226 |
<label for="king-addons-register-username-<?php echo esc_attr($widget_id); ?>"> |
| 3227 |
<?php echo esc_html($settings['register_username_label']); ?> |
| 3228 |
</label> |
| 3229 |
<?php endif; ?> |
| 3230 |
<input type="text" |
| 3231 |
id="king-addons-register-username-<?php echo esc_attr($widget_id); ?>" |
| 3232 |
name="username" |
| 3233 |
placeholder="<?php echo esc_attr($settings['register_username_placeholder']); ?>" |
| 3234 |
required> |
| 3235 |
</div> |
| 3236 |
|
| 3237 |
<?php if ($settings['show_website'] === 'yes'): ?> |
| 3238 |
<div class="king-addons-form-field"> |
| 3239 |
<?php if ($show_labels && !empty($settings['register_website_label'])): ?> |
| 3240 |
<label for="king-addons-register-website-<?php echo esc_attr($widget_id); ?>"> |
| 3241 |
<?php echo esc_html($settings['register_website_label']); ?> |
| 3242 |
</label> |
| 3243 |
<?php endif; ?> |
| 3244 |
<input type="url" |
| 3245 |
id="king-addons-register-website-<?php echo esc_attr($widget_id); ?>" |
| 3246 |
name="website" |
| 3247 |
placeholder="<?php echo esc_attr($settings['register_website_placeholder']); ?>"> |
| 3248 |
</div> |
| 3249 |
<?php endif; ?> |
| 3250 |
|
| 3251 |
<?php if ($settings['show_phone'] === 'yes'): ?> |
| 3252 |
<div class="king-addons-form-field"> |
| 3253 |
<?php if ($show_labels && !empty($settings['register_phone_label'])): ?> |
| 3254 |
<label for="king-addons-register-phone-<?php echo esc_attr($widget_id); ?>"> |
| 3255 |
<?php echo esc_html($settings['register_phone_label']); ?> |
| 3256 |
</label> |
| 3257 |
<?php endif; ?> |
| 3258 |
<input type="tel" |
| 3259 |
id="king-addons-register-phone-<?php echo esc_attr($widget_id); ?>" |
| 3260 |
name="phone" |
| 3261 |
placeholder="<?php echo esc_attr($settings['register_phone_placeholder']); ?>"> |
| 3262 |
</div> |
| 3263 |
<?php endif; ?> |
| 3264 |
|
| 3265 |
<div class="king-addons-form-field <?php echo $settings['show_password_visibility_register'] === 'yes' ? 'king-addons-password-field' : ''; ?>"> |
| 3266 |
<?php if ($show_labels && !empty($settings['register_password_label'])): ?> |
| 3267 |
<label for="king-addons-register-password-<?php echo esc_attr($widget_id); ?>"> |
| 3268 |
<?php echo esc_html($settings['register_password_label']); ?> |
| 3269 |
</label> |
| 3270 |
<?php endif; ?> |
| 3271 |
<div class="king-addons-password-input-wrapper"> |
| 3272 |
<input type="password" |
| 3273 |
id="king-addons-register-password-<?php echo esc_attr($widget_id); ?>" |
| 3274 |
name="password" |
| 3275 |
placeholder="<?php echo esc_attr($settings['register_password_placeholder']); ?>" |
| 3276 |
required> |
| 3277 |
<?php if ($settings['show_password_visibility_register'] === 'yes'): ?> |
| 3278 |
<button type="button" class="king-addons-password-toggle" aria-label="Toggle password visibility"> |
| 3279 |
<span class="king-addons-password-toggle-icon">👁</span> |
| 3280 |
</button> |
| 3281 |
<?php endif; ?> |
| 3282 |
</div> |
| 3283 |
</div> |
| 3284 |
|
| 3285 |
<div class="king-addons-form-field <?php echo $settings['show_password_visibility_register'] === 'yes' ? 'king-addons-password-field' : ''; ?>"> |
| 3286 |
<?php if ($show_labels && !empty($settings['register_confirm_password_label'])): ?> |
| 3287 |
<label for="king-addons-register-confirm-password-<?php echo esc_attr($widget_id); ?>"> |
| 3288 |
<?php echo esc_html($settings['register_confirm_password_label']); ?> |
| 3289 |
</label> |
| 3290 |
<?php endif; ?> |
| 3291 |
<div class="king-addons-password-input-wrapper"> |
| 3292 |
<input type="password" |
| 3293 |
id="king-addons-register-confirm-password-<?php echo esc_attr($widget_id); ?>" |
| 3294 |
name="confirm_password" |
| 3295 |
placeholder="<?php echo esc_attr($settings['register_confirm_password_placeholder']); ?>" |
| 3296 |
required> |
| 3297 |
<?php if ($settings['show_password_visibility_register'] === 'yes'): ?> |
| 3298 |
<button type="button" class="king-addons-password-toggle" aria-label="Toggle password visibility"> |
| 3299 |
<span class="king-addons-password-toggle-icon">👁</span> |
| 3300 |
</button> |
| 3301 |
<?php endif; ?> |
| 3302 |
</div> |
| 3303 |
</div> |
| 3304 |
|
| 3305 |
<?php $this->render_custom_fields($settings, $show_labels); ?> |
| 3306 |
|
| 3307 |
<?php if ($settings['show_user_role_selection'] === 'yes' && !empty($settings['allowed_user_roles'])): ?> |
| 3308 |
<div class="king-addons-form-field"> |
| 3309 |
<?php if ($show_labels && !empty($settings['user_role_label'])): ?> |
| 3310 |
<label for="king-addons-register-user-role-<?php echo esc_attr($widget_id); ?>"> |
| 3311 |
<?php echo esc_html($settings['user_role_label']); ?> |
| 3312 |
</label> |
| 3313 |
<?php endif; ?> |
| 3314 |
<select id="king-addons-register-user-role-<?php echo esc_attr($widget_id); ?>" name="user_role"> |
| 3315 |
<?php |
| 3316 |
$user_roles = $this->get_user_roles(); |
| 3317 |
foreach ($settings['allowed_user_roles'] as $role_key): |
| 3318 |
if (isset($user_roles[$role_key])): |
| 3319 |
?> |
| 3320 |
<option value="<?php echo esc_attr($role_key); ?>" |
| 3321 |
<?php selected($settings['default_user_role'], $role_key); ?>> |
| 3322 |
<?php echo esc_html($user_roles[$role_key]); ?> |
| 3323 |
</option> |
| 3324 |
<?php |
| 3325 |
endif; |
| 3326 |
endforeach; |
| 3327 |
?> |
| 3328 |
</select> |
| 3329 |
</div> |
| 3330 |
<?php endif; ?> |
| 3331 |
|
| 3332 |
<?php if ($settings['show_terms_conditions'] === 'yes'): ?> |
| 3333 |
<div class="king-addons-form-field king-addons-checkbox-field"> |
| 3334 |
<label> |
| 3335 |
<input type="checkbox" name="terms_conditions" value="1" |
| 3336 |
<?php echo $settings['terms_required'] === 'yes' ? 'required' : ''; ?>> |
| 3337 |
<?php |
| 3338 |
if (!empty($settings['terms_conditions_link']['url'])): |
| 3339 |
$link_target = $settings['terms_conditions_link']['is_external'] ? '_blank' : '_self'; |
| 3340 |
$link_nofollow = $settings['terms_conditions_link']['nofollow'] ? 'rel="nofollow"' : ''; |
| 3341 |
?> |
| 3342 |
<a href="<?php echo esc_url($settings['terms_conditions_link']['url']); ?>" |
| 3343 |
target="<?php echo esc_attr($link_target); ?>" |
| 3344 |
<?php echo $link_nofollow; ?>> |
| 3345 |
<?php echo esc_html($settings['terms_conditions_text']); ?> |
| 3346 |
</a> |
| 3347 |
<?php else: ?> |
| 3348 |
<?php echo esc_html($settings['terms_conditions_text']); ?> |
| 3349 |
<?php endif; ?> |
| 3350 |
</label> |
| 3351 |
</div> |
| 3352 |
<?php endif; ?> |
| 3353 |
|
| 3354 |
<?php $this->render_recaptcha($settings, 'register'); ?> |
| 3355 |
|
| 3356 |
<div class="king-addons-form-field"> |
| 3357 |
<button type="submit" class="king-addons-form-button king-addons-register-button"> |
| 3358 |
<?php echo esc_html($settings['register_button_text']); ?> |
| 3359 |
</button> |
| 3360 |
</div> |
| 3361 |
|
| 3362 |
<div class="king-addons-form-links"> |
| 3363 |
<?php if ($settings['show_login_link'] === 'yes'): ?> |
| 3364 |
<span class="king-addons-form-toggle" data-toggle="login"> |
| 3365 |
<?php echo esc_html($settings['login_link_text']); ?> |
| 3366 |
</span> |
| 3367 |
<?php endif; ?> |
| 3368 |
</div> |
| 3369 |
</form> |
| 3370 |
|
| 3371 |
<?php $this->render_social_login($settings, 'register'); ?> |
| 3372 |
</div> |
| 3373 |
<?php endif; ?> |
| 3374 |
|
| 3375 |
<?php if ($settings['show_lost_password_link'] === 'yes'): ?> |
| 3376 |
<div class="king-addons-lost-password-form" id="lost-password-form-<?php echo esc_attr($widget_id); ?>" style="display: none;"> |
| 3377 |
|
| 3378 |
<?php if (!empty($settings['lostpassword_form_title'])): ?> |
| 3379 |
<h3 class="king-addons-form-title"><?php echo esc_html($settings['lostpassword_form_title']); ?></h3> |
| 3380 |
<?php endif; ?> |
| 3381 |
|
| 3382 |
<?php if (!empty($settings['lostpassword_form_subtitle'])): ?> |
| 3383 |
<p class="king-addons-form-subtitle"><?php echo esc_html($settings['lostpassword_form_subtitle']); ?></p> |
| 3384 |
<?php endif; ?> |
| 3385 |
|
| 3386 |
<div class="king-addons-form-message"></div> |
| 3387 |
|
| 3388 |
<form class="king-addons-form" method="post"> |
| 3389 |
<?php wp_nonce_field('king_addons_lostpassword_action', 'king_addons_lostpassword_nonce'); ?> |
| 3390 |
|
| 3391 |
<div class="king-addons-form-field"> |
| 3392 |
<?php if ($show_labels && !empty($settings['lostpassword_email_label'])): ?> |
| 3393 |
<label for="king-addons-lostpassword-email-<?php echo esc_attr($widget_id); ?>"> |
| 3394 |
<?php echo esc_html($settings['lostpassword_email_label']); ?> |
| 3395 |
</label> |
| 3396 |
<?php endif; ?> |
| 3397 |
<input type="email" |
| 3398 |
id="king-addons-lostpassword-email-<?php echo esc_attr($widget_id); ?>" |
| 3399 |
name="user_login" |
| 3400 |
placeholder="<?php echo esc_attr($settings['lostpassword_email_placeholder']); ?>" |
| 3401 |
required> |
| 3402 |
</div> |
| 3403 |
|
| 3404 |
<div class="king-addons-form-field"> |
| 3405 |
<button type="submit" class="king-addons-form-button king-addons-lostpassword-button"> |
| 3406 |
<?php echo esc_html($settings['lostpassword_button_text']); ?> |
| 3407 |
</button> |
| 3408 |
</div> |
| 3409 |
|
| 3410 |
<div class="king-addons-form-links"> |
| 3411 |
<?php if ($settings['show_login_link_from_lostpassword'] === 'yes'): ?> |
| 3412 |
<span class="king-addons-form-toggle" data-toggle="login"> |
| 3413 |
<?php echo esc_html($settings['login_link_text_from_lostpassword']); ?> |
| 3414 |
</span> |
| 3415 |
<?php endif; ?> |
| 3416 |
</div> |
| 3417 |
</form> |
| 3418 |
</div> |
| 3419 |
<?php endif; ?> |
| 3420 |
</div> |
| 3421 |
<?php |
| 3422 |
} |
| 3423 |
|
| 3424 |
|
| 3425 |
|
| 3426 |
|
| 3427 |
} |