Guest User

form-login

a guest
Jan 30th, 2019
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.27 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Login Form
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-login.php.
  6.  *
  7.  * HOWEVER, on occasion WooCommerce will need to update template files and you
  8.  * (the theme developer) will need to copy the new files to your theme to
  9.  * maintain compatibility. We try to do this as little as possible, but it does
  10.  * happen. When this occurs the version of the template file will be bumped and
  11.  * the readme will list any important changes.
  12.  *
  13.  * @see     https://docs.woocommerce.com/document/template-structure/
  14.  * @package WooCommerce/Templates
  15.  * @version 3.5.0
  16.  */
  17.  
  18. if ( ! defined( 'ABSPATH' ) ) {
  19.     exit; // Exit if accessed directly.
  20. }
  21.  
  22. $tabs = woodmart_get_opt( 'login_tabs' );
  23. $reg_text = woodmart_get_opt( 'reg_text' );
  24. $login_text = woodmart_get_opt( 'login_text' );
  25.  
  26. $class = 'woodmart-registration-page';
  27.  
  28. if ( $tabs && get_option( 'woocommerce_enable_myaccount_registration' ) === 'yes' ) {
  29.     $class .= ' woodmart-register-tabs active-register';
  30. }
  31.  
  32. if ( get_option( 'woocommerce_enable_myaccount_registration' ) !== 'yes' ) {
  33.     $class .= ' woodmart-no-registration';
  34. }
  35.  
  36. if ( $login_text && $reg_text ) {
  37.     $class .= ' with-login-reg-info';
  38. }
  39.  
  40. //WC 3.5.0
  41. if ( version_compare( WC()->version, '3.5.0', '<' ) ) {
  42.     wc_print_notices();
  43. }
  44.  
  45. do_action( 'woocommerce_before_customer_login_form' ); ?>
  46.  
  47. <div class="<?php echo esc_attr( $class ); ?>">
  48.  
  49. <?php if ( get_option( 'woocommerce_enable_myaccount_registration' ) === 'yes' ) : ?>
  50.  
  51. <div class="row" id="customer_login">
  52.  
  53.     <div class="col-12 col-md-6 col-login">
  54.  
  55. <?php endif; ?>
  56.  
  57.         <h2><?php esc_html_e( 'Login', 'woocommerce' ); ?></h2>
  58.  
  59.         <?php woodmart_login_form(); ?>
  60.        
  61. <?php if ( get_option( 'woocommerce_enable_myaccount_registration' ) === 'yes' ) : ?>
  62.  
  63.     </div>
  64.  
  65.     <div class="col-12 col-md-6 col-register">
  66.  
  67.         <h2><?php esc_html_e( 'Register', 'woocommerce' ); ?></h2>
  68.  
  69.         <form method="post" class="woocommerce-form woocommerce-form-register register" <?php do_action( 'woocommerce_register_form_tag' ); ?> >
  70.  
  71.             <?php do_action( 'woocommerce_register_form_start' ); ?>
  72.  
  73.             <?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>
  74.  
  75.                 <p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
  76.                     <label for="reg_username"><?php esc_html_e( 'Username', 'woocommerce' ); ?>&nbsp;<span class="required">*</span></label>
  77.                     <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" autocomplete="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( $_POST['username'] ) : ''; ?>" />
  78.                 </p>
  79.  
  80.             <?php endif; ?>
  81.  
  82.             <p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
  83.                 <label for="reg_email"><?php esc_html_e( 'Email address', 'woocommerce' ); ?>&nbsp;<span class="required">*</span></label>
  84.                 <input type="email" class="woocommerce-Input woocommerce-Input--text input-text" name="email" id="reg_email" autocomplete="email" value="<?php echo ( ! empty( $_POST['email'] ) ) ? esc_attr( $_POST['email'] ) : ''; ?>" />
  85.             </p>
  86.  
  87.             <?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?>
  88.  
  89.                 <p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
  90.                     <label for="reg_password"><?php esc_html_e( 'Password', 'woocommerce' ); ?>&nbsp;<span class="required">*</span></label>
  91.                     <input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password" id="reg_password" autocomplete="new-password" />
  92.                 </p>
  93.  
  94.             <?php endif; ?>
  95.  
  96.             <!-- Spam Trap -->
  97.             <div style="<?php echo ( ( is_rtl() ) ? 'right' : 'left' ); ?>: -999em; position: absolute;"><label for="trap"><?php esc_html_e( 'Anti-spam', 'woocommerce' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>
  98.  
  99.             <?php do_action( 'woocommerce_register_form' ); ?>
  100.  
  101.             <p class="woocommerce-FormRow form-row">
  102.                 <?php wp_nonce_field( 'woocommerce-register' ); ?>
  103.                 <button type="submit" class="woocommerce-Button button" name="register" value="<?php esc_attr_e( 'Register', 'woocommerce' ); ?>"><?php esc_html_e( 'Register', 'woocommerce' ); ?></button>
  104.             </p>
  105.  
  106.             <?php do_action( 'woocommerce_register_form_end' ); ?>
  107.  
  108.         </form>
  109.  
  110.     </div>
  111.  
  112.     <?php if ( $tabs ): ?>
  113.         <div class="col-12 col-md-6 col-register-text">
  114.  
  115.             <span class="register-or"><?php esc_html_e( 'Or', 'woodmart' ); ?></span>
  116.  
  117.             <?php if ( $login_text ): ?>
  118.                 <h2><?php esc_html_e( 'Login', 'woocommerce' ); ?></h2>
  119.             <?php else: ?>
  120.                 <h2><?php esc_html_e( 'Register', 'woocommerce' ); ?></h2>
  121.             <?php endif ?>
  122.  
  123.             <?php if ( $login_text ): ?>
  124.                 <div class="login-info"><?php echo ( $login_text ); ?></div>
  125.             <?php endif ?>
  126.  
  127.             <?php if ( $reg_text ): ?>
  128.                 <div class="registration-info"><?php echo ( $reg_text ); ?></div>
  129.             <?php endif ?>
  130.  
  131.             <a href="#" class="btn woodmart-switch-to-register" data-login="<?php esc_html_e( 'Login', 'woocommerce') ?>" data-register="<?php esc_html_e( 'Register', 'woocommerce') ?>"><?php esc_html_e( 'Login', 'woocommerce') ?></a>
  132.  
  133.         </div>
  134.     <?php endif ?>
  135.    
  136. </div>
  137. <?php endif; ?>
  138.  
  139. </div><!-- .woodmart-registration-page -->
  140.  
  141. <?php do_action( 'woocommerce_after_customer_login_form' ); ?>
Advertisement
Add Comment
Please, Sign In to add comment