PATH:
home
/
lab2454c
/
mact34.com
/
wp-content
/
plugins
/
tryo-toolkit
/
widgets
<?php /** * SignUp Widget */ namespace Elementor; class Tryo_Signup extends Widget_Base { public function get_name() { return 'Signup'; } public function get_title() { return __( 'Signup', 'tryo-toolkit' ); } public function get_icon() { return 'fa fa-fast-backward'; } public function get_categories() { return [ 'tryo-elements' ]; } protected function _register_controls() { $this->start_controls_section( 'Tryo_Section', [ 'label' => __( 'Tryo Section Controls', 'tryo-toolkit' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'image', [ 'label' => __( 'Image', 'tryo-toolkit' ), 'type' => Controls_Manager::MEDIA, ] ); $this->add_control( 'title', [ 'label' => __( 'Title', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Open up your Tryo Account now', 'tryo-toolkit'), ] ); $this->add_control( 'question_text', [ 'label' => __( 'Question Text', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Already signed up?', 'tryo-toolkit'), ] ); $this->add_control( 'button_text', [ 'label' => __( 'Button Text', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Login', 'tryo-toolkit'), ] ); $this->add_control( 'link_type', [ 'label' => __( 'Link Type', 'tryo-toolkit' ), 'type' => Controls_Manager::SELECT, 'label_block' => true, 'options' => [ '1' => __( 'Link To Page', 'tryo-toolkit' ), '2' => __( 'External Link', 'tryo-toolkit' ), ], ] ); $this->add_control( 'link_to_page', [ 'label' => __( 'Link Page', 'tryo-toolkit' ), 'type' => Controls_Manager::SELECT, 'label_block' => true, 'options' => tryo_toolkit_get_page_as_list(), 'condition' => [ 'link_type' => '1', ] ] ); $this->add_control( 'external_link', [ 'label' => __('External Link', 'tryo-toolkit'), 'type' => Controls_Manager:: TEXT, 'condition' => [ 'link_type' => '2', ] ] ); $this->add_control( 'user_placeholder', [ 'label' => __( 'User Placeholder', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Username/Email', 'tryo-toolkit'), ] ); $this->add_control( 'fname_placeholder', [ 'label' => __( 'First Name Placeholder', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('First Name', 'tryo-toolkit'), ] ); $this->add_control( 'lname_placeholder', [ 'label' => __( 'Last Name Placeholder', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Last Name', 'tryo-toolkit'), ] ); $this->add_control( 'email_placeholder', [ 'label' => __( 'Email Placeholder', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Email', 'tryo-toolkit'), ] ); $this->add_control( 'pass_placeholder', [ 'label' => __( 'Password Placeholder', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Password', 'tryo-toolkit'), ] ); $this->add_control( 'phone_placeholder', [ 'label' => __( 'Phone Placeholder', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Phone', 'tryo-toolkit'), ] ); $this->add_control( 'acc_placeholder', [ 'label' => __( 'Account Number Placeholder', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Account Number', 'tryo-toolkit'), ] ); $this->add_control( 'signup_button_text', [ 'label' => __( 'SignUp Button Text', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Signup', 'tryo-toolkit'), ] ); $this->add_control( 'terms_content', [ 'label' => __( 'Content', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXTAREA, ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); global $tryo_opt; if( isset( $tryo_opt['enable_lazyloader'] ) ): $is_lazyloader = $tryo_opt['enable_lazyloader']; else: $is_lazyloader = true; endif; if( $is_lazyloader == true ): $lazy_class = 'smartify'; $lazy_attr = 'sm-'; else: $lazy_class = ''; $lazy_attr = ''; endif; if ( is_user_logged_in() ) { wp_redirect( home_url( '/' ) ); exit(); //echo "<script>window.open('".site_url()."','_self')</script>"; } // Button link $link_source = ''; if ( $settings['link_type'] == 1 ) : $link_source = get_page_link($settings['link_to_page']); else : $link_source = $settings['external_link']; endif; $error = ''; $success = ''; global $wpdb, $PasswordHash, $current_user, $user_ID; if (isset($_POST['submit']) ) { $password = trim($_POST['password']); $email = trim($_POST['email']); $username = trim($_POST['username']); $fname = trim($_POST['first_name']); $lname = trim($_POST['last_name']); $phonenum = trim($_POST['phone_number']); $accnum = trim($_POST['acc_number']); $acc_sql = $wpdb->get_results("SELECT user_id, meta_value AS acc_number FROM wp_usermeta WHERE meta_key='acc_number'"); $phn_sql = $wpdb->get_results("SELECT user_id, meta_value AS phone_number FROM wp_usermeta WHERE meta_key='phone_number'"); foreach ($acc_sql as $acc_sql) { $cur_acc_num = $acc_sql->acc_number; if( $cur_acc_num == $accnum ) { $acc_num_already = 1; break; } else { $acc_num_already = 0; } } foreach ($phn_sql as $phn_sql) { $cur_phn_num = $phn_sql->phone_number; if( $cur_phn_num == $phonenum ) { $phn_num_already = 1; break; } else { $phn_num_already = 0; } } if( $email == "" || $password == "" || $fname == "" || $lname == "" || $phonenum == "" || $accnum == "" || $username == "" ) { $error= 'Please don\'t leave the required fields.'; } else if(username_exists( $username )) { $error= 'username already exist.'; }else if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error= 'Invalid email address.'; } else if(email_exists($email) ) { $error= 'Email already exist.'; } else if( $acc_num_already == 1 ) { $error= 'Account Number already exist.'; } else if( $phn_num_already == 1 ) { $error= 'Phone Number already exist.'; } else { $user_id = wp_insert_user( array ( 'user_pass' => apply_filters('pre_user_user_pass', $password), 'user_login' => apply_filters('pre_user_user_login', $username), 'user_email' => apply_filters('pre_user_user_email', $email), 'role' => 'customer_author' ) ); if( is_wp_error($user_id) ) { $error= 'Error on user creation.'; } else { do_action('user_register', $user_id); wp_redirect( home_url( '/' )."customer-login" ); exit(); } } } ?> <section class="signup-area"> <div class="row m-0"> <div class="col-lg-6 col-md-12 p-0"> <div class="signup-image" style="background-image:url( <?php echo esc_url( $settings['image']['url'] ); ?> );"> <img class="<?php echo esc_attr($lazy_class); ?>" <?php echo esc_attr($lazy_attr); ?>src="<?php echo esc_url( $settings['image']['url'] ); ?>" alt="<?php echo esc_attr__('image', 'tryo-toolkit' ); ?>"> </div> </div> <div class="col-lg-6 col-md-12 p-0"> <div class="signup-content"> <div class="d-table"> <div class="d-table-cell"> <div class="signup-form"> <div class="logo"> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"> <?php tryo_sticky_logo(); ?> </a> </div> <h3><?php echo esc_html( $settings['title'] ); ?></h3> <p><?php echo esc_html( $settings['question_text'] ); ?> <?php if ( $settings['button_text'] != '' ) : ?> <a href="<?php echo esc_url( $link_source ); ?>"> <?php echo esc_html( $settings['button_text'] ); ?> </a> <?php endif; ?> </p> <form method="post" autocomplete="off"> <div id="message"> <?php if ( isset($error) && $error != '' ) { ?> <div class="alert alert-danger" role="alert"> <?php echo esc_html($error); ?> </div> <?php } ?> </div> <div class="form-group"> <input type="text" name="username" placeholder="<?php echo esc_attr( $settings['user_placeholder'] ); ?>" class="form-control" required="required"> </div> <div class="form-group"> <input type="text" name="first_name" placeholder="<?php echo esc_attr( $settings['fname_placeholder'] ); ?>" class="form-control" required="required"> </div> <div class="form-group"> <input type="text" name="last_name" placeholder="<?php echo esc_attr( $settings['lname_placeholder'] ); ?>" class="form-control" required="required"> </div> <div class="form-group"> <input type="email" name="email" placeholder="<?php echo esc_attr( $settings['email_placeholder'] ); ?>" class="form-control" required="required"> </div> <div class="form-group"> <input type="password" name="password" placeholder="<?php echo esc_attr( $settings['pass_placeholder'] ); ?>" class="form-control" required="required"> </div> <div class="form-group"> <input type="number" name="phone_number" placeholder="<?php echo esc_attr( $settings['phone_placeholder'] ); ?>" class="form-control" required="required"> </div> <div class="form-group"> <input type="number" name="acc_number" placeholder="<?php echo esc_attr( $settings['acc_placeholder'] ); ?>" class="form-control" onKeyPress="if(this.value.length==12) return false;" required="required"> </div> <div class="form-group"> <div class="form-checkbox"> <label><input type="checkbox" name="terms_check" class="check-class" value="Option 1" required="required"><?php echo wp_kses_post($settings['terms_content'],'tryo') ?></label> </div> </div> <button type="submit" name="submit" class="btn btn-primary"><?php echo esc_html( $settings['signup_button_text'] ); ?></button> </form> </div> </div> </div> </div> </div> </div> </section> <?php } protected function _content_template() {} } Plugin::instance()->widgets_manager->register_widget_type( new Tryo_Signup );
[-] banner-feature.php
[edit]
[-] profile-form.php
[edit]
[-] business-area.php
[edit]
[-] services-two.php
[edit]
[-] banner-two.php
[edit]
[-] signup.php
[edit]
[+]
..
[-] payment-experience-area.php
[edit]
[-] post.php
[edit]
[-] works.php
[edit]
[-] account-create.php
[edit]
[-] comparisons-table.php
[edit]
[-] partner-slider.php
[edit]
[-] app-download.php
[edit]
[-] feature-box.php
[edit]
[-] team.php
[edit]
[-] global-area.php
[edit]
[-] userinfo-details.php
[edit]
[-] banner-three.php
[edit]
[-] pricing.php
[edit]
[-] success-story-area.php
[edit]
[-] contact-card.php
[edit]
[-] contact-cta-box.php
[edit]
[-] services-area.php
[edit]
[-] ready-to-talk.php
[edit]
[-] section.php
[edit]
[-] receive-details.php
[edit]
[-] about-area.php
[edit]
[-] banner-four.php
[edit]
[-] send-details.php
[edit]
[-] support-area.php
[edit]
[-] invoicing.php
[edit]
[-] testimonials.php
[edit]
[-] funfact.php
[edit]
[-] signin.php
[edit]
[-] information-box.php
[edit]
[-] new-payment.php
[edit]
[-] banner-one.php
[edit]
[-] feedback-card.php
[edit]
[-] feature.php
[edit]