PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.3.0
Easy Elements for Elementor – Addons & Website Templates v1.3.0
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / widgets / login-register / login-register.php

login-register.php in Easy Elements for Elementor – Addons & Website Templates 1.3.0, at widgets/login-register/login-register.php

1,725 lines 55.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Easyel\EasyElements\Widgets;
3 /**
4 * Easy Elements Login Register Widget
5 * @package EasyElements
6 * @since 1.0.0
7 */
8 use Elementor\Controls_Manager;
9 use Elementor\Widget_Base;
10 use Elementor\Group_Control_Typography;
11 use Elementor\Group_Control_Border;
12 use Elementor\Group_Control_Box_Shadow;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17 /**
18 *
19 * Handles the login register widget functionality for Elementor.
20 */
21 class Easyel_Login_Register_Widget extends \Elementor\Widget_Base {
22
23 /**
24 * Get widget style dependencies
25 *
26 * Loads the CSS file for the widget styling
27 *
28 * @return array Array of style handles
29 */
30 /**
31 * Get widget name
32 *
33 * @return string Widget name
34 */
35 public function get_name() {
36 return 'eel-login-register';
37 }
38
39 /**
40 * Get widget title
41 *
42 * @return string Widget title
43 */
44 public function get_title() {
45 return __( 'Login / Register', 'easy-elements' );
46 }
47
48 /**
49 * Get widget icon
50 *
51 * @return string Widget icon
52 */
53 public function get_icon() {
54 return 'easyicon easyelIcon-login';
55 }
56
57 /**
58 * Get widget categories
59 *
60 * @return array Widget categories
61 */
62 public function get_categories() {
63 return [ 'easyelements_category' ];
64 }
65
66 public function get_keywords() {
67 return [ 'login', 'register', 'from', 'text', 'form' ];
68 }
69
70 public function get_style_depends() {
71 return [
72 'eel-login-register',
73 ];
74 }
75
76 public function get_script_depends() {
77 return [
78 'eel-login-register',
79 ];
80 }
81
82
83 /**
84 * Register widget controls
85 *
86 * Defines all the controls for the widget
87 */
88 protected function register_controls() {
89 global $wp_roles;
90 $role_options = $wp_roles->get_names();
91 // ========================================
92 // CONTENT SECTION - Form Settings
93 // ========================================
94 $this->start_controls_section(
95 'content_section',
96 [
97 'label' => esc_html__( 'Form', 'easy-elements' ),
98 'tab' => Controls_Manager::TAB_CONTENT,
99 ]
100 );
101
102 $this->add_control(
103 'form_type',
104 [
105 'label' => esc_html__( 'Type', 'easy-elements' ),
106 'type' => \Elementor\Controls_Manager::SELECT,
107 'default' => 'login',
108 'options' => [
109 'login' => esc_html__( 'Login', 'easy-elements' ),
110 'register' => esc_html__( 'Register', 'easy-elements' ),
111 'both' => esc_html__( 'Both', 'easy-elements' ),
112 ],
113 ]
114 );
115 $this->add_control(
116 'redirect_link_after_login',
117 [
118 'label' => esc_html__( 'Redirect Link After Login', 'easy-elements' ),
119 'type' => \Elementor\Controls_Manager::URL,
120 'options' => [ 'url', 'is_external', 'nofollow' ],
121 'default' => [
122 'url' => home_url(),
123 'is_external' => true,
124 'nofollow' => true,
125 ],
126 'label_block' => true,
127 'condition' => [
128 'form_type' => ['login'],
129 ],
130 ]
131 );
132
133
134 $this->add_control(
135 'role',
136 [
137 'label' => 'Role',
138 'type' => \Elementor\Controls_Manager::SELECT,
139 'options' => $role_options,
140 'multiple' => false,
141 'default' => 'subscriber'
142 ]
143 );
144 $this->add_control(
145 'auto_login_after_registration',
146 [
147 'label' => esc_html__( 'Auto Login After Registration', 'easy-elements' ),
148 'type' => \Elementor\Controls_Manager::SWITCHER,
149 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
150 'label_off' => esc_html__( 'No', 'easy-elements' ),
151 'return_value' => 'yes',
152 'default' => 'yes',
153 'condition' => [
154 'form_type' => ['register'],
155 ],
156 ]
157 );
158 $this->add_control(
159 'redirect_after_registration',
160 [
161 'label' => esc_html__( 'Redirect After Logout', 'easy-elements' ),
162 'type' => \Elementor\Controls_Manager::SWITCHER,
163 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
164 'label_off' => esc_html__( 'No', 'easy-elements' ),
165 'return_value' => 'yes',
166 'default' => 'yes',
167 'condition' => [
168 'form_type' => ['register', 'both'],
169 ],
170 ]
171 );
172 $this->add_control(
173 'redirect_link_after_registration',
174 [
175 'label' => esc_html__( 'Redirect Link After Registration', 'easy-elements' ),
176 'type' => \Elementor\Controls_Manager::URL,
177 'options' => [ 'url', 'is_external', 'nofollow' ],
178 'default' => [
179 'url' => home_url(),
180 'is_external' => true,
181 'nofollow' => true,
182 // 'custom_attributes' => '',
183 ],
184 'label_block' => true,
185 'condition' => [
186 'form_type' => ['register', 'both'],
187 ],
188 ]
189 );
190
191 $this->add_control(
192 'show_password_reset_link',
193 [
194 'label' => esc_html__( 'Show Password Reset Link', 'easy-elements' ),
195 'type' => \Elementor\Controls_Manager::SWITCHER,
196 'label_on' => esc_html__( 'Show', 'easy-elements' ),
197 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
198 'return_value' => 'yes',
199 'default' => 'yes',
200 'condition' => [
201 'form_type' => ['login'],
202 ],
203 ]
204 );
205 $this->add_control(
206 'remember_me',
207 [
208 'label' => esc_html__( 'Show Remember Me', 'easy-elements' ),
209 'type' => \Elementor\Controls_Manager::SWITCHER,
210 'label_on' => esc_html__( 'Show', 'easy-elements' ),
211 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
212 'return_value' => 'yes',
213 'default' => 'yes',
214 'condition' => [
215 'form_type' => ['login'],
216 ],
217 ]
218 );
219 $this->add_control(
220 'show_ajax_loader',
221 [
222 'label' => esc_html__( 'Show Ajax Loader', 'easy-elements' ),
223 'type' => \Elementor\Controls_Manager::SWITCHER,
224 'label_on' => esc_html__( 'Show', 'easy-elements' ),
225 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
226 'return_value' => 'yes',
227 'default' => 'yes',
228 ]
229 );
230 $this->end_controls_section();
231
232
233 // ========================================
234 // CONTENT SECTION - Fields Settings
235 // ========================================
236 $this->start_controls_section(
237 'fields_section',
238 [
239 'label' => esc_html__( 'Fields', 'easy-elements' ),
240 'tab' => Controls_Manager::TAB_CONTENT,
241 ]
242 );
243
244 $this->add_control(
245 'login_fields',
246 [
247 'label' => esc_html__( 'Login Fields', 'easy-elements' ),
248 'type' => Controls_Manager::REPEATER,
249 'fields' => [
250 // Type Field
251 [
252 'name' => 'type',
253 'label' => esc_html__( 'Type', 'easy-elements' ),
254 'type' => \Elementor\Controls_Manager::SELECT,
255 'default' => 'username',
256 'options' => [
257 'username' => esc_html__( 'Username', 'easy-elements' ),
258 'password' => esc_html__( 'Password', 'easy-elements' ),
259 'static_text' => esc_html__( 'Static Text', 'easy-elements' ),
260 ],
261 ],
262 // Label Field
263 [
264 'name' => 'label',
265 'label' => esc_html__( 'Label', 'easy-elements' ),
266 'type' => Controls_Manager::TEXT,
267 'condition' => [
268 'type!' => 'static_text',
269 ],
270 ],
271 // Placeholder Field
272 [
273 'name' => 'placeholder',
274 'label' => esc_html__( 'Placeholder', 'easy-elements' ),
275 'type' => Controls_Manager::TEXT,
276 'condition' => [
277 'type!' => 'static_text',
278 ],
279 ],
280 // Icon Field
281 [
282 'name' => 'icon',
283 'label' => esc_html__( 'Icon', 'easy-elements' ),
284 'type' => Controls_Manager::ICONS,
285 'condition' => [
286 'type!' => 'static_text',
287 ],
288 ],
289 [
290 'name' => 'is_required',
291 'label' => esc_html__( 'Is Required', 'easy-elements' ),
292 'type' => \Elementor\Controls_Manager::SWITCHER,
293 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
294 'label_off' => esc_html__( 'No', 'easy-elements' ),
295 'return_value' => 'yes',
296 'default' => 'yes',
297 'condition' => [
298 'type!' => 'static_text',
299 ],
300 ],
301 [
302 'name' => 'static_text',
303 'label' => esc_html__('Static Text', 'easy-elements'),
304 'type' => Controls_Manager::WYSIWYG,
305 'label_block' => true,
306 'default' => esc_html__("This is static field.", "easy-elements"),
307 'dynamic' => [
308 'active' => true,
309 ],
310 'condition' => [
311 'type' => 'static_text',
312 ],
313 ]
314 ],
315
316 // Default register fields
317 'default' => [
318 [
319 'type' => 'username',
320 'label' => esc_html__( 'Username', 'easy-elements' ),
321 'placeholder' => esc_html__( 'Username', 'easy-elements' ),
322 'is_required' => 'yes',
323 ],
324 [
325 'type' => 'password',
326 'label' => esc_html__( 'Password', 'easy-elements' ),
327 'placeholder' => esc_html__( 'Password', 'easy-elements' ),
328 'is_required' => 'yes',
329 ],
330 ],
331 'title_field' => '{{{ type }}}',
332 'condition' => [
333 'form_type' => ['login'],
334 ],
335 ]
336 );
337
338 $this->add_control(
339 'register_fields',
340 [
341 'label' => esc_html__( 'Register Fields', 'easy-elements' ),
342 'type' => Controls_Manager::REPEATER,
343 'fields' => [
344 // Type Field
345 [
346 'name' => 'type',
347 'label' => esc_html__( 'Type', 'easy-elements' ),
348 'type' => \Elementor\Controls_Manager::SELECT,
349 'default' => 'username',
350 'options' => [
351 'user_login' => esc_html__( 'Username', 'easy-elements' ),
352 'user_email' => esc_html__( 'Email', 'easy-elements' ),
353 'user_pass' => esc_html__( 'Password', 'easy-elements' ),
354 'confirm_password' => esc_html__( 'Confirm Password', 'easy-elements' ),
355 'first_name' => esc_html__( 'First Name', 'easy-elements' ),
356 'last_name' => esc_html__( 'Last Name', 'easy-elements' ),
357 'display_name' => esc_html__( 'Display Name', 'easy-elements' ),
358 'user_nicename' => esc_html__( 'Nice Name', 'easy-elements' ),
359 'nickname ' => esc_html__( 'Nice Name', 'easy-elements' ),
360 'user_url' => esc_html__( 'Website', 'easy-elements' ),
361 'description' => esc_html__( 'Description', 'easy-elements' ),
362 'consent' => esc_html__( 'Consent', 'easy-elements' ),
363 'custom' => esc_html__( 'Custom', 'easy-elements' ),
364 'static_text' => esc_html__( 'Static Text', 'easy-elements' ),
365 ],
366 ],
367 // Custom User Meta Key Field
368 [
369 'name' => 'meta_key',
370 'label' => esc_html__( 'Meta Key', 'easy-elements' ),
371 'type' => Controls_Manager::TEXT,
372 'condition' => [
373 'type' => 'custom',
374 ],
375 ],
376 // Label Field
377 [
378 'name' => 'label',
379 'label' => esc_html__( 'Label', 'easy-elements' ),
380 'type' => Controls_Manager::TEXT,
381 'condition' => [
382 'type!' => 'static_text',
383 ],
384 ],
385 // Placeholder Field
386 [
387 'name' => 'placeholder',
388 'label' => esc_html__( 'Placeholder', 'easy-elements' ),
389 'type' => Controls_Manager::TEXT,
390 'condition' => [
391 'type!' => 'static_text',
392 ],
393 ],
394 // Icon Field
395 [
396 'name' => 'icon',
397 'label' => esc_html__( 'Icon', 'easy-elements' ),
398 'type' => Controls_Manager::ICONS,
399 'condition' => [
400 'type!' => 'static_text',
401 ],
402 ],
403 [
404 'name' => 'min_length',
405 'label' => esc_html__( 'Min Length', 'easy-elements' ),
406 'type' => Controls_Manager::NUMBER,
407 'condition' => [
408 'type!' => 'static_text',
409 ],
410 ],
411 [
412 'name' => 'max_length',
413 'label' => esc_html__( 'Max Length', 'easy-elements' ),
414 'type' => Controls_Manager::NUMBER,
415 'condition' => [
416 'type!' => 'static_text',
417 ],
418 ],
419 [
420 'name' => 'is_required',
421 'label' => esc_html__( 'Is Required', 'easy-elements' ),
422 'type' => \Elementor\Controls_Manager::SWITCHER,
423 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
424 'label_off' => esc_html__( 'No', 'easy-elements' ),
425 'return_value' => 'yes',
426 'default' => 'yes',
427 'condition' => [
428 'type!' => 'static_text',
429 ],
430 ],
431 [
432 'name' => 'static_text',
433 'label' => esc_html__('Static Text', 'easy-elements'),
434 'type' => Controls_Manager::WYSIWYG,
435 'label_block' => true,
436 'default' => esc_html__("Don't have account? Sign Up", "easy-elements"),
437 'dynamic' => [
438 'active' => true,
439 ],
440 'condition' => [
441 'type' => 'static_text',
442 ],
443 ],
444 [
445 'name' => 'width',
446 'label' => esc_html__('Width', 'easy-elements'),
447 'type' => Controls_Manager::SLIDER,
448 'size_units' => ['px', '%', 'em'],
449 'range' => [
450 'px' => [
451 'min' => 10,
452 'max' => 50,
453 ],
454 'em' => [
455 'min' => 0.5,
456 'max' => 10,
457 ],
458 '%' => [
459 'min' => 2,
460 'max' => 100,
461 ],
462 ],
463 'default' => [
464 'unit' => '%',
465 ],
466 ]
467 ],
468
469 // Default register fields
470 'default' => [
471 [
472 'type' => 'user_login',
473 'label' => esc_html__( 'Username', 'easy-elements' ),
474 'placeholder' => esc_html__( 'Username', 'easy-elements' ),
475 'is_required' => 'yes',
476 ],
477 [
478 'type' => 'user_email',
479 'label' => esc_html__( 'Email', 'easy-elements' ),
480 'placeholder' => esc_html__( 'Email', 'easy-elements' ),
481 'is_required' => 'yes',
482 ],
483 [
484 'type' => 'user_pass',
485 'label' => esc_html__( 'Password', 'easy-elements' ),
486 'placeholder' => esc_html__( 'Password', 'easy-elements' ),
487 'is_required' => 'yes',
488 'min_length' => 8,
489 ],
490 ],
491 'title_field' => '{{{ type }}}',
492 'condition' => [
493 'form_type' => ['register', 'both'],
494 ],
495 ]
496 );
497
498 $this->add_control(
499 'show_label',
500 [
501 'label' => esc_html__( 'Show Label', 'easy-elements' ),
502 'type' => \Elementor\Controls_Manager::SWITCHER,
503 'label_on' => esc_html__( 'Show', 'easy-elements' ),
504 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
505 'return_value' => 'yes',
506 'default' => 'yes',
507 'condition' => [
508 'show_icon!' => 'yes',
509 ],
510 ]
511 );
512 $this->add_control(
513 'show_icon',
514 [
515 'label' => esc_html__( 'Show Icon', 'easy-elements' ),
516 'type' => \Elementor\Controls_Manager::SWITCHER,
517 'label_on' => esc_html__( 'Show', 'easy-elements' ),
518 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
519 'return_value' => 'yes',
520 'description' => esc_html__( 'Enable this option to display an icon field inside the repeater items.', 'easy-elements' ),
521 ]
522 );
523
524 $this->add_control(
525 'login_fields_labels',
526 [
527 'label' => esc_html__( 'Labels', 'easy-elements' ),
528 'type' => \Elementor\Controls_Manager::HEADING,
529 'separator' => 'before',
530 'condition' => [
531 'form_type' => ['login'],
532 ],
533 ]
534 );
535 $this->add_control(
536 'password_reset_text',
537 [
538 'label' => esc_html__( 'Password Reset Text', 'easy-elements' ),
539 'type' => \Elementor\Controls_Manager::TEXT,
540 'label_block' => true,
541 'default' => esc_html__( 'Forgot your password?', 'easy-elements' ),
542 'placeholder' => esc_html__( 'Type your text here', 'easy-elements' ),
543 'condition' => [
544 'form_type' => ['login'],
545 'show_password_reset_link' => ['yes'],
546 ],
547 ]
548 );
549 $this->add_control(
550 'remember_label_text',
551 [
552 'label' => esc_html__('Remember', 'easy-elements'),
553 'type' => Controls_Manager::TEXT,
554 'label_block' => true,
555 'default' => esc_html__('Remember Me', 'easy-elements'),
556 'placeholder' => esc_html__('Enter text here', 'easy-elements'),
557 'dynamic' => [
558 'active' => true,
559 ],
560 'condition' => [
561 'from_type' => ['login'],
562 ],
563 ]
564 );
565 $this->add_control(
566 'cta_text',
567 [
568 'label' => esc_html__('Text', 'easy-elements'),
569 'type' => Controls_Manager::WYSIWYG,
570 'label_block' => true,
571 'default' => esc_html__("Don't have account? Sign Up", "easy-elements"),
572 'dynamic' => [
573 'active' => true,
574 ],
575 ]
576 );
577 $this->end_controls_section();
578
579
580 // ========================================
581 // CONTENT SECTION - Submit Button
582 // ========================================
583 $this->start_controls_section(
584 'submit_button_section',
585 [
586 'label' => esc_html__( 'Submit', 'easy-elements' ),
587 'tab' => Controls_Manager::TAB_CONTENT,
588 ]
589 );
590 $this->add_control(
591 'submit_button_text',
592 [
593 'label' => esc_html__('Text', 'easy-elements'),
594 'type' => Controls_Manager::TEXT,
595 'label_block' => true,
596 'default' => esc_html__('Log In', 'easy-elements'),
597 'placeholder' => esc_html__('Enter text here', 'easy-elements'),
598 'dynamic' => [
599 'active' => true,
600 ],
601 ]
602 );
603
604 $this->add_control(
605 'submit_button_icon',
606 [
607 'label' => esc_html__('Icon', 'easy-elements'),
608 'type' => Controls_Manager::ICONS,
609 'default' => [
610 'value' => '',
611 'library' => '',
612 ],
613 ]
614 );
615
616 $this->add_control(
617 'submit_button_icon_position',
618 [
619 'label' => esc_html__('Icon Position', 'easy-elements'),
620 'type' => Controls_Manager::SELECT,
621 'default' => 'after',
622 'options' => [
623 'before' => esc_html__('Before Text', 'easy-elements'),
624 'after' => esc_html__('After Text', 'easy-elements'),
625 ],
626 'condition' => [
627 'submit_button_icon[value]!' => '',
628 ],
629 ]
630 );
631 $this->end_controls_section();
632
633
634 // ========================================
635 // CONTENT SECTION - Message
636 // ========================================
637 $this->start_controls_section(
638 'message_section',
639 [
640 'label' => esc_html__( 'Message', 'easy-elements' ),
641 'tab' => Controls_Manager::TAB_CONTENT,
642 ]
643 );
644 $this->add_control(
645 'show_success_message',
646 [
647 'label' => esc_html__( 'Show Success Message', 'easy-elements' ),
648 'type' => \Elementor\Controls_Manager::SWITCHER,
649 'label_on' => esc_html__( 'Show', 'easy-elements' ),
650 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
651 'return_value' => 'yes',
652 'default' => 'yes',
653 ]
654 );
655 $this->add_control(
656 'login_success_message',
657 [
658 'label' => esc_html__( 'Login Succeess Message', 'easy-elements' ),
659 'type' => \Elementor\Controls_Manager::TEXTAREA,
660 'label_block' => true,
661 'default' => esc_html__( 'Login Success!', 'easy-elements' ),
662 'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ),
663 'condition' => [
664 'form_type' => ['login'],
665 'show_success_message' => ['yes'],
666 ],
667 ]
668 );
669 $this->add_control(
670 'register_success_message',
671 [
672 'label' => esc_html__( 'Register Succeess Message', 'easy-elements' ),
673 'type' => \Elementor\Controls_Manager::TEXTAREA,
674 'label_block' => true,
675 'default' => esc_html__( 'Registration Success!', 'easy-elements' ),
676 'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ),
677 'condition' => [
678 'form_type' => ['register'],
679 'show_success_message' => ['yes'],
680 ],
681 ]
682 );
683 $this->add_control(
684 'show_error_message',
685 [
686 'label' => esc_html__( 'Show Failed Message', 'easy-elements' ),
687 'type' => \Elementor\Controls_Manager::SWITCHER,
688 'label_on' => esc_html__( 'Show', 'easy-elements' ),
689 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
690 'return_value' => 'yes',
691 'default' => 'yes',
692 ]
693 );
694 $this->add_control(
695 'login_error_message',
696 [
697 'label' => esc_html__( 'Login Failed Message', 'easy-elements' ),
698 'type' => \Elementor\Controls_Manager::TEXTAREA,
699 'label_block' => true,
700 'default' => esc_html__( 'Login failed! Enter correct email & password.', 'easy-elements' ),
701 'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ),
702 'condition' => [
703 'form_type' => ['login'],
704 'show_error_message' => ['yes'],
705 ],
706 ]
707 );
708 $this->add_control(
709 'register_error_message',
710 [
711 'label' => esc_html__( 'Register Failed Message', 'easy-elements' ),
712 'type' => \Elementor\Controls_Manager::TEXTAREA,
713 'label_block' => true,
714 'default' => esc_html__( 'Registration Failed!', 'easy-elements' ),
715 'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ),
716 'condition' => [
717 'form_type' => ['register'],
718 'show_error_message' => ['yes'],
719 ],
720 ]
721 );
722 $this->add_control(
723 'already_logged_in_message',
724 [
725 'label' => esc_html__( 'Already logged in Message', 'easy-elements' ),
726 'type' => \Elementor\Controls_Manager::TEXTAREA,
727 'label_block' => true,
728 'default' => esc_html__( 'You are already logged in. Goto Homepage', 'easy-elements' ),
729 'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ),
730 ]
731 );
732 $this->add_control(
733 'empty_error_message',
734 [
735 'label' => esc_html__( 'Empty Message', 'easy-elements' ),
736 'type' => \Elementor\Controls_Manager::TEXTAREA,
737 'label_block' => true,
738 'default' => esc_html__( 'This field is required.', 'easy-elements' ),
739 'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ),
740 ]
741 );
742 $this->add_control(
743 'confirm_pass_error_message',
744 [
745 'label' => esc_html__( 'Confirm Passowrd Error Message', 'easy-elements' ),
746 'type' => \Elementor\Controls_Manager::TEXTAREA,
747 'label_block' => true,
748 'default' => esc_html__( 'Confirm passowrd not matched', 'easy-elements' ),
749 'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ),
750 ]
751 );
752 $this->add_control(
753 'min_length_error_message',
754 [
755 'label' => esc_html__( 'Minimum Characters Error Message', 'easy-elements' ),
756 'type' => \Elementor\Controls_Manager::TEXTAREA,
757 'label_block' => true,
758 'default' => esc_html__( 'Minimum {count} characters required.', 'easy-elements' ),
759 'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ),
760 ]
761 );
762 $this->add_control(
763 'max_length_error_message',
764 [
765 'label' => esc_html__( 'Maximum Characters Error Message', 'easy-elements' ),
766 'type' => \Elementor\Controls_Manager::TEXTAREA,
767 'label_block' => true,
768 'default' => esc_html__( 'Maximum {count} characters required.', 'easy-elements' ),
769 'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ),
770 ]
771 );
772 $this->end_controls_section();
773
774 // ========================================
775 // STYLE SECTION - Fields Style
776 // ========================================
777 $this->start_controls_section(
778 'form_fileds_style_section',
779 [
780 'label' => esc_html__( 'Fields', 'easy-elements' ),
781 'tab' => Controls_Manager::TAB_STYLE,
782 ]
783 );
784
785 $this->add_control(
786 'field_input_color',
787 [
788 'label' => esc_html__( 'Color', 'easy-elements' ),
789 'type' => Controls_Manager::COLOR,
790 'selectors' => [
791 '{{WRAPPER}} .eel-form-control' => 'color: {{VALUE}};',
792 ],
793 'separator' => 'before',
794 ]
795 );
796 $this->add_control(
797 'field_input_color_placeholder',
798 [
799 'label' => esc_html__( 'Placeholder Color', 'easy-elements' ),
800 'type' => Controls_Manager::COLOR,
801 'selectors' => [
802 '{{WRAPPER}} .eel-form-control::placeholder' => 'color: {{VALUE}};',
803 ],
804 ]
805 );
806
807 $this->add_control(
808 'field_wrapper_background_color',
809 [
810 'label' => esc_html__( 'Background Color', 'easy-elements' ),
811 'type' => Controls_Manager::COLOR,
812 'selectors' => [
813 '{{WRAPPER}} .eel-form-control, {{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner' => 'background-color: {{VALUE}};',
814 ],
815 ]
816 );
817
818 $this->add_group_control(
819 \Elementor\Group_Control_Typography::get_type(),
820 [
821 'name' => 'input_text_typography',
822 'selector' => '{{WRAPPER}} .eel-authentication-form .eel-form-control',
823 ]
824 );
825
826 $this->add_control(
827 'field_wrapper_padding',
828 [
829 'label' => esc_html__( 'Padding', 'easy-elements' ),
830 'type' => \Elementor\Controls_Manager::DIMENSIONS,
831 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
832 'selectors' => [
833 '{{WRAPPER}} .eel-authentication-form .eel-authentication-form-field-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
834 ],
835 ]
836 );
837
838 $this->add_control(
839 'input_margin',
840 [
841 'label' => esc_html__( 'Margin', 'easy-elements' ),
842 'type' => \Elementor\Controls_Manager::DIMENSIONS,
843 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
844 'selectors' => [
845 '{{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
846 ],
847 ]
848 );
849
850 $this->add_control(
851 'input_border_radius',
852 [
853 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
854 'type' => Controls_Manager::DIMENSIONS,
855 'size_units' => [ 'px', '%' ],
856 'selectors' => [
857 '{{WRAPPER}} form:not(.eel-input-has-icon) .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-form-control, {{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
858 ],
859 ]
860 );
861
862 $this->add_group_control(
863 \Elementor\Group_Control_Border::get_type(),
864 [
865 'name' => 'field_wrapper_border',
866 'selector' => '{{WRAPPER}} form:not(.eel-input-has-icon) .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-form-control, {{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner',
867 ]
868 );
869
870 $this->add_group_control(
871 \Elementor\Group_Control_Box_Shadow::get_type(),
872 [
873 'name' => 'field_wrapper_box_shadow',
874 'selector' => '{{WRAPPER}} form:not(.eel-input-has-icon) .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-form-control, {{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner',
875 ]
876 );
877
878 $this->add_control(
879 'field_icon_styles',
880 [
881 'label' => esc_html__( 'Icons', 'easy-elements' ),
882 'type' => \Elementor\Controls_Manager::HEADING,
883 'separator' => 'before',
884 'condition' => [
885 'show_icon' => ['yes'],
886 ],
887 ]
888 );
889
890 $this->add_control(
891 'icon_color',
892 [
893 'label' => esc_html__( 'Color', 'easy-elements' ),
894 'type' => Controls_Manager::COLOR,
895 'selectors' => [
896 '{{WRAPPER}} .eel-authentication-form .eel-form-field-icon' => 'color: {{VALUE}};',
897 '{{WRAPPER}} .eel-authentication-form .eel-form-field-icon svg' => 'fill: {{VALUE}};',
898 ],
899 'condition' => [
900 'show_icon' => ['yes'],
901 ],
902 ]
903 );
904 $this->add_responsive_control(
905 'icon_size',
906 [
907 'label' => esc_html__('Icon Size', 'easy-elements'),
908 'type' => Controls_Manager::SLIDER,
909 'size_units' => ['px'],
910 'range' => [
911 'px' => [
912 'min' => 6,
913 'max' => 50,
914 ],
915 'em' => [
916 'min' => 0.5,
917 'max' => 10,
918 ],
919 ],
920 'default' => [
921 'unit' => 'px',
922 'size' => 18,
923 ],
924 'selectors' => [
925 '{{WRAPPER}} .eel-authentication-form .eel-form-field-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
926 '{{WRAPPER}} .eel-authentication-form .eel-form-field-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
927 ],
928 'condition' => [
929 'show_icon' => ['yes'],
930 ],
931 ]
932 );
933 $this->end_controls_section();
934
935
936 // ========================================
937 // STYLE SECTION - Fields Style
938 // ========================================
939 $this->start_controls_section(
940 'form_label_style_section',
941 [
942 'label' => esc_html__( 'Label', 'easy-elements' ),
943 'tab' => Controls_Manager::TAB_STYLE,
944 'condition' => [
945 'show_label' => ['yes'],
946 ],
947 ]
948 );
949
950 $this->add_control(
951 'field_label_color',
952 [
953 'label' => esc_html__( 'Color', 'easy-elements' ),
954 'type' => Controls_Manager::COLOR,
955 'selectors' => [
956 '{{WRAPPER}} .eel-authentication-form .eel-authentication-form-label' => 'color: {{VALUE}};',
957 ],
958 'condition' => [
959 'show_label' => ['yes'],
960 ],
961 ]
962 );
963
964 $this->add_group_control(
965 \Elementor\Group_Control_Typography::get_type(),
966 [
967 'name' => 'field_label_typography',
968 'selector' => '{{WRAPPER}} .eel-authentication-form .eel-authentication-form-label',
969 'separator' => 'before',
970 'condition' => [
971 'show_label' => ['yes'],
972 ],
973 ]
974 );
975
976 $this->add_control(
977 'field_label_margin',
978 [
979 'label' => esc_html__( 'Margin', 'easy-elements' ),
980 'type' => \Elementor\Controls_Manager::DIMENSIONS,
981 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
982 'selectors' => [
983 '{{WRAPPER}} .eel-authentication-form .eel-authentication-form-label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
984 ],
985 'condition' => [
986 'show_label' => ['yes'],
987 ],
988 ]
989 );
990
991 $this->end_controls_section();
992
993 // ========================================
994 // STYLE SECTION - Links Style
995 // ========================================
996 $this->start_controls_section(
997 'links_style_section',
998 [
999 'label' => esc_html__( 'Links', 'easy-elements' ),
1000 'tab' => Controls_Manager::TAB_STYLE,
1001 ]
1002 );
1003
1004 $this->add_control(
1005 'links_color',
1006 [
1007 'label' => esc_html__( 'Color', 'easy-elements' ),
1008 'type' => \Elementor\Controls_Manager::COLOR,
1009 'selectors' => [
1010 '{{WRAPPER}} .eel-authentication-form a' => 'color: {{VALUE}}',
1011 ],
1012 ]
1013 );
1014 $this->add_control(
1015 'links_color_hoevr',
1016 [
1017 'label' => esc_html__( 'Hover Color', 'easy-elements' ),
1018 'type' => \Elementor\Controls_Manager::COLOR,
1019 'selectors' => [
1020 '{{WRAPPER}} .eel-authentication-form a:hover' => 'color: {{VALUE}}',
1021 ],
1022 ]
1023 );
1024
1025 $this->add_group_control(
1026 \Elementor\Group_Control_Typography::get_type(),
1027 [
1028 'name' => 'links_typography',
1029 'selector' => '{{WRAPPER}} .eel-authentication-form a',
1030 ]
1031 );
1032
1033 // Border Control
1034 $this->add_group_control(
1035 Group_Control_Border::get_type(),
1036 [
1037 'name' => 'links_border',
1038 'selector' => '{{WRAPPER}} .eel-authentication-form .eel-authentication-form-field-inner.eel-authentication-form-links-field',
1039 ]
1040 );
1041 $this->end_controls_section();
1042
1043 // ========================================
1044 // STYLE SECTION - Submit Button Style
1045 // ========================================
1046 $this->start_controls_section(
1047 'submit_button_style_section',
1048 [
1049 'label' => esc_html__( 'Submit', 'easy-elements' ),
1050 'tab' => Controls_Manager::TAB_STYLE,
1051 ]
1052 );
1053
1054 $this->start_controls_tabs('submit_button_style_tabs');
1055
1056 $this->start_controls_tab(
1057 'submit_button_normal_tab',
1058 [
1059 'label' => esc_html__('Normal', 'easy-elements'),
1060 ]
1061 );
1062
1063 $this->add_control(
1064 'submit_button_color',
1065 [
1066 'label' => esc_html__( 'Color', 'easy-elements' ),
1067 'type' => Controls_Manager::COLOR,
1068 'selectors' => [
1069 '{{WRAPPER}} .eel-submit-button' => 'color: {{VALUE}};',
1070 '{{WRAPPER}} .eel-form-btn-icon svg path' => 'fill: {{VALUE}};',
1071 ],
1072 ]
1073 );
1074
1075 $this->add_group_control(
1076 \Elementor\Group_Control_Background::get_type(),
1077 [
1078 'name' => 'submit_button_background_color',
1079 'types' => [ 'classic', 'gradient', 'video' ],
1080 'selector' => '{{WRAPPER}} .eel-authentication-form .eel-submit-button',
1081 ]
1082 );
1083
1084 $this->add_control(
1085 'submit_button_wrapper_padding',
1086 [
1087 'label' => esc_html__( 'Padding', 'easy-elements' ),
1088 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1089 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1090 'selectors' => [
1091 '{{WRAPPER}} .eel-authentication-form .eel-submit-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1092 ],
1093 ]
1094 );
1095
1096 $this->add_control(
1097 'submit_button_wrapper_margin',
1098 [
1099 'label' => esc_html__( 'Margin', 'easy-elements' ),
1100 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1101 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1102 'selectors' => [
1103 '{{WRAPPER}} .eel-authentication-form .eel-submit-button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1104 ],
1105 ]
1106 );
1107
1108 // Button Size Control
1109 $this->add_responsive_control(
1110 'submit_button_width',
1111 [
1112 'label' => esc_html__('Width', 'easy-elements'),
1113 'type' => Controls_Manager::SLIDER,
1114 'size_units' => ['px', '%', 'em'],
1115 'range' => [
1116 'px' => [
1117 'min' => 10,
1118 'max' => 500,
1119 ],
1120 'em' => [
1121 'min' => 0.5,
1122 'max' => 10,
1123 ],
1124 '%' => [
1125 'min' => 1,
1126 'max' => 100,
1127 ],
1128 ],
1129 'default' => [
1130 'unit' => '%',
1131 'size' => 100,
1132 ],
1133 'selectors' => [
1134 '{{WRAPPER}} .eel-authentication-form-field.eel-authentication-form-submit-field' => 'width: {{SIZE}}{{UNIT}};',
1135 ],
1136 ]
1137 );
1138
1139 // Border Radius Control
1140 $this->add_control(
1141 'submit_button_border_radius',
1142 [
1143 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
1144 'type' => Controls_Manager::DIMENSIONS,
1145 'size_units' => [ 'px', '%' ],
1146 'selectors' => [
1147 '{{WRAPPER}} .eel-authentication-form .eel-submit-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1148 ],
1149 ]
1150 );
1151
1152 // Border Control
1153 $this->add_group_control(
1154 Group_Control_Border::get_type(),
1155 [
1156 'name' => 'submit_button_border',
1157 'selector' => '{{WRAPPER}} .eel-authentication-form .eel-submit-button',
1158 ]
1159 );
1160
1161 // Box Shadow Control
1162 $this->add_group_control(
1163 Group_Control_Box_Shadow::get_type(),
1164 [
1165 'name' => 'submit_button_box_shadow',
1166 'selector' => '{{WRAPPER}} .eel-authentication-form .eel-submit-button',
1167 ]
1168 );
1169
1170 // Icon Size Control
1171 $this->add_control(
1172 'submit_button_icon_size',
1173 [
1174 'label' => esc_html__( 'Icon Size', 'easy-elements' ),
1175 'type' => Controls_Manager::SLIDER,
1176 'size_units' => [ 'px', 'em' ],
1177 'range' => [
1178 'px' => [
1179 'min' => 10,
1180 'max' => 50,
1181 'step' => 1,
1182 ],
1183 'em' => [
1184 'min' => 0.5,
1185 'max' => 3,
1186 'step' => 0.1,
1187 ],
1188 ],
1189 'default' => [
1190 'unit' => 'px',
1191 'size' => 18,
1192 ],
1193 'selectors' => [
1194 '{{WRAPPER}} .eel-submit-button i' => 'font-size: {{SIZE}}{{UNIT}};',
1195 '{{WRAPPER}} .eel-submit-button svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
1196 ],
1197 ]
1198 );
1199
1200 // Icon Horizontal Position
1201 $this->add_responsive_control(
1202 'submit_button_icon_position_x',
1203 [
1204 'label' => esc_html__( 'Icon Horizontal Position', 'easy-elements' ),
1205 'type' => Controls_Manager::SLIDER,
1206 'size_units' => [ 'px', '%', 'em' ],
1207 'range' => [
1208 'px' => [ 'min' => -100, 'max' => 100 ],
1209 '%' => [ 'min' => -100, 'max' => 100 ],
1210 'em' => [ 'min' => -5, 'max' => 5 ],
1211 ],
1212 'selectors' => [
1213 '{{WRAPPER}} .eel-form-btn-icon' => 'left: {{SIZE}}{{UNIT}};',
1214 ],
1215 ]
1216 );
1217
1218 // Icon Vertical Position
1219 $this->add_responsive_control(
1220 'submit_button_icon_position_y',
1221 [
1222 'label' => esc_html__( 'Icon Vertical Position', 'easy-elements' ),
1223 'type' => Controls_Manager::SLIDER,
1224 'size_units' => [ 'px', '%', 'em' ],
1225 'range' => [
1226 'px' => [ 'min' => -100, 'max' => 100 ],
1227 '%' => [ 'min' => -100, 'max' => 100 ],
1228 'em' => [ 'min' => -5, 'max' => 5 ],
1229 ],
1230 'selectors' => [
1231 '{{WRAPPER}} .eel-form-btn-icon' => 'top: {{SIZE}}{{UNIT}};',
1232 ],
1233 ]
1234 );
1235
1236
1237 $this->end_controls_tab();
1238
1239 $this->start_controls_tab(
1240 'submit_button_hover_tab',
1241 [
1242 'label' => esc_html__('Hover', 'easy-elements'),
1243 ]
1244 );
1245
1246 // Button Hover Color Control
1247 $this->add_control(
1248 'submit_button_hover_color',
1249 [
1250 'label' => esc_html__( 'Color', 'easy-elements' ),
1251 'type' => Controls_Manager::COLOR,
1252 'selectors' => [
1253 '{{WRAPPER}} .eel-authentication-form .eel-submit-button:hover' => 'color: {{VALUE}};',
1254 '{{WRAPPER}} .eel-authentication-form .eel-submit-button:hover svg path' => 'fill: {{VALUE}};',
1255 ],
1256 ]
1257 );
1258
1259 $this->add_group_control(
1260 \Elementor\Group_Control_Background::get_type(),
1261 [
1262 'name' => 'submit_button_hover_bg_color',
1263 'types' => [ 'classic', 'gradient', 'video' ],
1264 'selector' => '{{WRAPPER}} .eel-authentication-form .eel-submit-button:hover',
1265 ]
1266 );
1267
1268 $this->end_controls_tab();
1269 $this->end_controls_section();
1270
1271 $this->start_controls_section(
1272 'message_style_section',
1273 [
1274 'label' => esc_html__( 'Message', 'easy-elements' ),
1275 'tab' => Controls_Manager::TAB_STYLE,
1276 ]
1277 );
1278 $this->add_group_control(
1279 \Elementor\Group_Control_Typography::get_type(),
1280 [
1281 'name' => 'message_typography',
1282 'selector' => '{{WRAPPER}} .eel-authentication-form .eel-form-status',
1283 ]
1284 );
1285
1286 $this->add_control(
1287 'msg_padding',
1288 [
1289 'label' => esc_html__( 'Padding', 'easy-elements' ),
1290 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1291 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1292 'selectors' => [
1293 '{{WRAPPER}} .eel-authentication-form .eel-form-status' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1294 ],
1295 ]
1296 );
1297
1298 $this->add_control(
1299 'msg_margin',
1300 [
1301 'label' => esc_html__( 'Margin', 'easy-elements' ),
1302 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1303 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1304 'selectors' => [
1305 '{{WRAPPER}} .eel-authentication-form .eel-form-status' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1306 ],
1307 ]
1308 );
1309
1310 $this->add_control(
1311 'success_message_styles',
1312 [
1313 'label' => esc_html__( 'Success Message', 'easy-elements' ),
1314 'type' => \Elementor\Controls_Manager::HEADING,
1315 'separator' => 'before',
1316 ]
1317 );
1318
1319 $this->add_control(
1320 'success_message_color',
1321 [
1322 'label' => esc_html__( 'Color', 'easy-elements' ),
1323 'type' => \Elementor\Controls_Manager::COLOR,
1324 'selectors' => [
1325 '{{WRAPPER}} .eel-authentication-form .eel-form-status .eel-form-success-msg' => 'color: {{VALUE}}',
1326 ],
1327 ]
1328 );
1329 $this->add_control(
1330 'error_message_styles',
1331 [
1332 'label' => esc_html__( 'Failed Message', 'easy-elements' ),
1333 'type' => \Elementor\Controls_Manager::HEADING,
1334 'separator' => 'before',
1335 ]
1336 );
1337 $this->add_control(
1338 'error_message_color',
1339 [
1340 'label' => esc_html__( 'Color', 'easy-elements' ),
1341 'type' => \Elementor\Controls_Manager::COLOR,
1342 'selectors' => [
1343 '{{WRAPPER}} .eel-authentication-form .eel-form-status .eel-form-error-msg' => 'color: {{VALUE}}',
1344 ],
1345 ]
1346 );
1347
1348
1349 $this->end_controls_section();
1350 }
1351
1352 public function render_login_form($settings = []) {
1353
1354 if ( is_user_logged_in() ) {
1355 $already_logged_in_message = !empty($settings['already_logged_in_message']) ? $settings['already_logged_in_message'] : 'You are already logged in. Goto Homepage';
1356 echo '<a href="'. esc_url(home_url()) .'">'. esc_html( $already_logged_in_message ) .'</a>';
1357 return;
1358 }
1359
1360 $show_ajax_loader = !empty($settings['show_ajax_loader']) ? $settings['show_ajax_loader'] : 'yes';
1361 $show_label = !empty($settings['show_label']) ? $settings['show_label'] : '';
1362 $show_icon = !empty($settings['show_icon']) ? $settings['show_icon'] : '';
1363 $show_icons = !empty($settings['show_icon']) ? 'eel-input-has-icon' : '';
1364 $show_success_message = !empty($settings['show_success_message']) ? $settings['show_success_message'] : 'yes';
1365 $show_error_message = !empty($settings['show_error_message']) ? $settings['show_error_message'] : 'yes';
1366 $login_success_message = !empty($settings['login_success_message']) ? $settings['login_success_message'] : 'Login Success';
1367 $login_error_message = !empty($settings['login_error_message']) ? $settings['login_error_message'] : 'Login failed! Enter correct email & password.';
1368 $empty_error_message = !empty($settings['empty_error_message']) ? $settings['empty_error_message'] : 'This field is required.';
1369
1370 $show_password_reset_link = !empty($settings['show_password_reset_link']) ? $settings['show_password_reset_link'] : 'yes';
1371 $password_reset_text = !empty($settings['password_reset_text']) ? $settings['password_reset_text'] : '';
1372
1373 $remember_me = !empty($settings['remember_me']) ? $settings['remember_me'] : '';
1374 $remember_label_text = !empty($settings['remember_label_text']) ? $settings['remember_label_text'] : 'Remember Me';
1375 $submit_button_text = !empty($settings['submit_button_text']) ? $settings['submit_button_text'] : 'Log in';
1376 $submit_button_icon = !empty($settings['submit_button_icon']['value']) ? $settings['submit_button_icon'] : '';
1377 $submit_button_icon_position = !empty($settings['submit_button_icon_position']) ? $settings['submit_button_icon_position'] : '';
1378
1379 $redirect_after_login = !empty($settings['redirect_after_login']) ? $settings['redirect_after_login'] : 'yes';
1380 $redirect_link_after_login = !empty($settings['redirect_link_after_login']['url']) ? $settings['redirect_link_after_login']['url'] : home_url();
1381
1382
1383 $cta_text = !empty($settings['cta_text']) ? $settings['cta_text'] : '';
1384
1385 $login_fields = !empty($settings['login_fields']) ? $settings['login_fields'] : '';
1386
1387 ?>
1388 <form method="post" class="eel-authentication-form eel-login-form <?php echo esc_attr( $show_icons ); ?>">
1389 <input type="hidden" name="login_redirect_link" value="<?php echo esc_url( $redirect_link_after_login )?>">
1390 <input type="hidden" name="empty_error_msg" value="<?php echo esc_attr( $empty_error_message )?>">
1391 <?php
1392 if(!empty($login_fields) && is_array($login_fields)) {
1393 foreach ($login_fields as $field) {
1394 $type = !empty($field['type']) ? $field['type'] : 'username';
1395 $id = 'eel_' . $type;
1396 $label = !empty($field['label']) ? $field['label'] : '';
1397 $placeholder = !empty($field['placeholder']) ? $field['placeholder'] : '';
1398 $icon = !empty($field['icon']['value']) ? $field['icon'] : '';
1399 $is_required = !empty($field['is_required']) ? 'required' : '';
1400 $static_text = !empty($field['static_text']) ? $field['static_text'] : '';
1401
1402
1403 if($type =='static_text' && !empty($static_text)) {
1404 ?>
1405 <div class="eel-authentication-form-field eel-authentication-form-static-field">
1406 <div class="eel-authentication-form-field-inner">
1407 <div class="eel-form-control-wrap">
1408 <?php echo wp_kses_post( $static_text ); ?>
1409 </div>
1410 </div>
1411 </div>
1412 <?php
1413 }else{
1414 ?>
1415 <div class="eel-authentication-form-field">
1416 <div class="eel-authentication-form-field-inner">
1417 <?php if ($show_icon == 'yes' && !empty($icon['value'])): ?>
1418 <span class="eel-form-field-icon">
1419 <?php \Elementor\Icons_Manager::render_icon( $icon, [ 'aria-hidden' => 'true' ] ); ?>
1420 </span>
1421 <?php endif; ?>
1422 <div class="eel-form-control-wrap">
1423 <?php
1424 if($show_label == 'yes' && !empty($label)) {
1425 ?>
1426 <label for="<?php echo esc_attr( $id ) ?>" class="eel-authentication-form-label"><?php echo esc_html( $label ); ?></label>
1427 <?php
1428 }
1429 ?>
1430 <input type="text" name="<?php echo esc_attr( $type ) ?>" class="eel-form-control" id="<?php echo esc_attr( $id ) ?>" placeholder="<?php echo esc_attr( $placeholder ) ?>" <?php echo esc_attr( $is_required ) ?> autocomplete />
1431 </div>
1432 </div>
1433 <div class="eel-error-msg" data-error-for="<?php echo esc_attr( $id )?>"></div>
1434 </div>
1435 <?php
1436 }
1437
1438
1439 }
1440 }
1441 ?>
1442 <?php
1443 if($remember_me == 'yes' || $show_password_reset_link == 'yes') { ?>
1444 <div class="eel-authentication-form-field eel-authentication-form-checkbox-field">
1445 <div class="eel-authentication-form-field-inner">
1446 <div class="eel-form-control-wrap">
1447 <?php if($remember_me == 'yes') { ?>
1448 <label class="eel-authentication-form-label">
1449 <input type="checkbox" name="eel_rememberme" id="eel_rememberme" value="forever" />
1450 <?php echo esc_attr( $remember_label_text )?>
1451 </label>
1452 <?php } ?>
1453 <?php
1454 if($show_password_reset_link == 'yes') { ?>
1455 <a href="<?php echo esc_url( wp_lostpassword_url() )?>" target="_blank"><?php echo esc_html( $password_reset_text ) ?></a>
1456 <?php } ?>
1457 </div>
1458 </div>
1459 </div>
1460 <?php } ?>
1461
1462
1463 <div class="eel-authentication-form-field eel-authentication-form-submit-field">
1464 <div class="eel-authentication-form-field-inner">
1465 <div class="eel-form-control-wrap">
1466 <button type="submit" name="eel_login_submit" class="eel-submit-button">
1467 <?php
1468 if(!empty($submit_button_icon) && $submit_button_icon_position == 'before') {
1469 ?>
1470 <span class="eel-form-btn-icon">
1471 <?php \Elementor\Icons_Manager::render_icon( $submit_button_icon, [ 'aria-hidden' => 'true' ] ); ?>
1472 </span>
1473 <?php
1474 }
1475 ?>
1476 <span class="eel-form-btn-text"><?php echo esc_attr( $submit_button_text )?></span>
1477 <?php
1478 if(!empty($submit_button_icon) && $submit_button_icon_position == 'after') {
1479 ?>
1480 <span class="eel-form-btn-icon">
1481 <?php \Elementor\Icons_Manager::render_icon( $submit_button_icon, [ 'aria-hidden' => 'true' ] ); ?>
1482 </span>
1483 <?php
1484 }
1485 ?>
1486 <?php
1487 if($show_ajax_loader == 'yes') { ?>
1488 <span class="eel-form-ajax-loader">
1489 <img src="<?php echo esc_url( EASYELEMENTS_DIR_URL . 'widgets/login-register/img/ajax-loader.gif' )?>" alt="ajax loader">
1490 </span>
1491 <?php } ?>
1492 </button>
1493 </div>
1494 </div>
1495 </div>
1496
1497 <?php
1498 if(!empty($cta_text)) { ?>
1499 <div class="eel-authentication-form-field eel-authentication-form-cta-field">
1500 <div class="eel-authentication-form-field-inner">
1501 <div class="eel-form-control-wrap">
1502 <?php echo wp_kses_post( $cta_text ); ?>
1503 </div>
1504 </div>
1505 </div>
1506 <?php } ?>
1507
1508 <div class="eel-form-status">
1509 <?php
1510 if($show_error_message == 'yes') {
1511 ?>
1512 <p class="eel-form-error-msg"><?php echo esc_html( $login_error_message )?></p>
1513 <?php
1514 }
1515 if($show_success_message == 'yes') {
1516 ?>
1517 <p class="eel-form-success-msg"><?php echo esc_html( $login_success_message )?></p>
1518 <?php
1519 }
1520 ?>
1521 </div>
1522
1523 </form>
1524 <?php
1525
1526 }
1527
1528 public function render_register_form($settings = []) {
1529 $show_ajax_loader = !empty($settings['show_ajax_loader']) ? $settings['show_ajax_loader'] : 'yes';
1530 $show_label = !empty($settings['show_label']) ? $settings['show_label'] : '';
1531 $show_icon = !empty($settings['show_icon']) ? $settings['show_icon'] : '';
1532 $show_icons = !empty($settings['show_icon']) ? 'eel-input-has-icon' : '';
1533
1534 $show_success_message = !empty($settings['show_success_message']) ? $settings['show_success_message'] : 'yes';
1535 $show_error_message = !empty($settings['show_error_message']) ? $settings['show_error_message'] : 'yes';
1536 $register_success_message = !empty($settings['register_success_message']) ? $settings['register_success_message'] : 'Register Success';
1537 $register_error_message = !empty($settings['register_error_message']) ? $settings['register_error_message'] : 'Registration Failed';
1538 $empty_error_message = !empty($settings['empty_error_message']) ? $settings['empty_error_message'] : 'This field is required.';
1539 $confirm_pass_error_message = !empty($settings['confirm_pass_error_message']) ? $settings['confirm_pass_error_message'] : 'Confirm passowrd not matched';
1540 $min_length_error_message = !empty($settings['min_length_error_message']) ? $settings['min_length_error_message'] : 'Minimum {count} characters required.';
1541 $max_length_error_message = !empty($settings['max_length_error_message']) ? $settings['max_length_error_message'] : 'Maximum {count} characters required.';
1542
1543 $submit_button_text = !empty($settings['submit_button_text']) ? $settings['submit_button_text'] : 'Register';
1544 $submit_button_icon = !empty($settings['submit_button_icon']) ? $settings['submit_button_icon'] : '';
1545 $submit_button_icon_position = !empty($settings['submit_button_icon_position']) ? $settings['submit_button_icon_position'] : '';
1546
1547 $redirect_after_register = !empty($settings['redirect_after_register']) ? $settings['redirect_after_register'] : 'yes';
1548 $redirect_link_after_register = !empty($settings['redirect_link_after_register']['url']) ? $settings['redirect_link_after_register']['url'] : home_url();
1549
1550 $cta_text = !empty($settings['cta_text']) ? $settings['cta_text'] : '';
1551
1552 $register_fields = !empty($settings['register_fields']) ? $settings['register_fields'] : '';
1553 $role = !empty($settings['role']) ? $settings['role'] : 'subscriber';
1554 $auto_login_after_registration = !empty($settings['auto_login_after_registration']) ? $settings['auto_login_after_registration'] : 'yes';
1555
1556
1557
1558 ?>
1559 <form method="post" class="eel-authentication-form eel-register-form <?php echo esc_attr( $show_icons ); ?>">
1560 <input type="hidden" name="register_redirect_link" value="<?php echo esc_url( $redirect_link_after_register )?>">
1561 <input type="hidden" name="role" value="<?php echo esc_attr( $role )?>">
1562 <input type="hidden" name="auto_login_after_registration" value="<?php echo esc_attr( $auto_login_after_registration )?>">
1563 <input type="hidden" name="empty_error_msg" value="<?php echo esc_attr( $empty_error_message )?>">
1564 <input type="hidden" name="min_length_error_msg" value="<?php echo esc_attr( $min_length_error_message )?>">
1565 <input type="hidden" name="max_length_error_msg" value="<?php echo esc_attr( $max_length_error_message )?>">
1566 <input type="hidden" name="confirm_pass_error_msg" value="<?php echo esc_attr( $confirm_pass_error_message )?>">
1567 <?php
1568 if(!empty($register_fields) && is_array($register_fields)) {
1569 foreach ($register_fields as $field) {
1570
1571 $type = !empty($field['type']) ? $field['type'] : 'username';
1572 $input_type = $type == 'custom' && !empty($field['input_type']) ? $field['input_type'] : 'text';
1573 $meta_key = !empty($field['meta_key']) ? $field['meta_key'] : '';
1574 $id = 'eel_' . $type;
1575 $label = !empty($field['label']) ? $field['label'] : '';
1576 $placeholder = !empty($field['placeholder']) ? $field['placeholder'] : '';
1577 $icon = !empty($field['icon']['value']) ? $field['icon'] : '';
1578 $is_required = !empty($field['is_required']) ? 'required' : '';
1579 $static_text = !empty($field['static_text']) ? $field['static_text'] : '';
1580 $min_length = !empty($field['min_length']) ? $field['min_length'] : '1';
1581 $max_length = !empty($field['max_length']) ? $field['max_length'] : '';
1582 $width = !empty($field['width']['size']) ? $field['width']['size'] . $field['width']['unit'] : '';
1583
1584 if($type =='custom' && !empty($meta_key)){
1585 $type = 'custom_meta[' . $meta_key . ']';
1586 $id = 'eel_' . $meta_key;
1587 }
1588
1589 if($type =='consent') {
1590 ?>
1591 <div class="eel-authentication-form-field eel-authentication-form-checkbox-field" <?php echo !empty($width) ? 'style="width: '.esc_attr( $width ).';"' : '' ?>>
1592 <div class="eel-authentication-form-field-inner">
1593 <div class="eel-form-control-wrap">
1594 <label class="eel-authentication-form-label">
1595 <input type="checkbox" name="<?php echo esc_attr( $type ) ?>" id="<?php echo esc_attr( $id ) ?>" <?php echo esc_attr( $is_required ) ?>/>
1596 <?php echo esc_attr( $label )?>
1597 </label>
1598 </div>
1599 </div>
1600 <div class="eel-error-msg" data-error-for="<?php echo esc_attr( $id )?>"></div>
1601 </div>
1602 <?php
1603 }elseif($type =='static_text' && !empty($static_text)) {
1604 ?>
1605 <div class="eel-authentication-form-field eel-authentication-form-static-field" <?php echo !empty($width) ? 'style="width: '.esc_attr( $width ).';"' : '' ?>>
1606 <div class="eel-authentication-form-field-inner">
1607 <div class="eel-form-control-wrap">
1608 <?php echo wp_kses_post( $static_text ); ?>
1609 </div>
1610 </div>
1611 </div>
1612 <?php
1613 }else{
1614 ?>
1615 <div class="eel-authentication-form-field" <?php echo !empty($width) ? 'style="width: '.esc_attr( $width ).';"' : '' ?>>
1616 <div class="eel-authentication-form-field-inner">
1617 <?php if ($show_icon == 'yes' && !empty($icon['value'])): ?>
1618 <span class="eel-form-field-icon eel-user-icon">
1619 <?php \Elementor\Icons_Manager::render_icon( $icon, [ 'aria-hidden' => 'true' ] ); ?>
1620 </span>
1621 <?php endif; ?>
1622 <div class="eel-form-control-wrap">
1623 <?php
1624 if($show_label == 'yes' && !empty($label)) {
1625 ?>
1626 <label for="<?php echo esc_attr( $id ) ?>" class="eel-authentication-form-label"><?php echo esc_html( $label ); ?></label>
1627 <?php
1628 }
1629 ?>
1630 <input type="text" name="<?php echo esc_attr( $type ) ?>" class="eel-form-control" id="<?php echo esc_attr( $id ) ?>" placeholder="<?php echo esc_attr( $placeholder ) ?>" <?php echo esc_attr( $is_required ) ?> min="<?php echo esc_attr( $min_length )?>" max="<?php echo esc_attr( $max_length )?>"/>
1631 </div>
1632 </div>
1633 <div class="eel-error-msg" data-error-for="<?php echo esc_attr( $id )?>"></div>
1634 </div>
1635 <?php
1636 }
1637
1638
1639 }
1640 }
1641 ?>
1642 <div class="eel-authentication-form-field eel-authentication-form-submit-field">
1643 <div class="eel-authentication-form-field-inner">
1644 <div class="eel-form-control-wrap">
1645 <button type="submit" name="eel_login_submit" class="eel-submit-button"/>
1646 <?php
1647 if(!empty($submit_button_icon) && $submit_button_icon_position == 'before') {
1648 ?>
1649 <span class="eel-form-btn-icon">
1650 <?php \Elementor\Icons_Manager::render_icon( $submit_button_icon, [ 'aria-hidden' => 'true' ] ); ?>
1651 </span>
1652 <?php
1653 }
1654 ?>
1655 <span class="eel-form-btn-text"><?php echo esc_attr( $submit_button_text )?></span>
1656 <?php
1657 if(!empty($submit_button_icon) && $submit_button_icon_position == 'after') {
1658 ?>
1659 <span class="eel-form-btn-icon">
1660 <?php \Elementor\Icons_Manager::render_icon( $submit_button_icon, [ 'aria-hidden' => 'true' ] ); ?>
1661 </span>
1662 <?php
1663 }
1664 ?>
1665 <?php
1666 if($show_ajax_loader == 'yes') { ?>
1667 <span class="eel-form-ajax-loader">
1668 <img src="<?php echo esc_url( EASYELEMENTS_DIR_URL . 'widgets/login-register/img/ajax-loader.gif' )?>" alt="ajax loader">
1669 </span>
1670 <?php } ?>
1671 </button>
1672 </div>
1673 </div>
1674 </div>
1675 <?php
1676 if(!empty($cta_text)) { ?>
1677 <div class="eel-authentication-form-field eel-authentication-form-cta-field">
1678 <div class="eel-authentication-form-field-inner">
1679 <div class="eel-form-control-wrap">
1680 <?php echo wp_kses_post( $cta_text ); ?>
1681 </div>
1682 </div>
1683 </div>
1684 <?php } ?>
1685
1686 <div class="eel-form-status">
1687 <?php
1688 if($show_error_message == 'yes') {
1689 ?>
1690 <p class="eel-form-error-msg"><?php echo esc_html( $register_error_message )?></p>
1691 <?php
1692 }
1693 if($show_success_message == 'yes') {
1694 ?>
1695 <p class="eel-form-success-msg"><?php echo esc_html( $register_success_message )?></p>
1696 <?php
1697 }
1698 ?>
1699
1700
1701 </div>
1702
1703 </form>
1704 <?php
1705
1706 }
1707
1708 /**
1709 * Render widget output on the frontend
1710 *
1711 * Generates the HTML markup for the login registers
1712 */
1713 protected function render() {
1714 $settings = $this->get_settings_for_display();
1715 $form_type = !empty($settings['form_type']) ? $settings['form_type'] : 'login';
1716
1717 if($form_type == 'login') {
1718 $this->render_login_form($settings);
1719 }else{
1720 $this->render_register_form($settings);
1721 }
1722
1723 }
1724
1725 }