Login form hooks Closes #4059

This commit is contained in:
Mike Jolley 2013-11-13 12:12:23 +00:00
parent 2c25568e21
commit 35fc728090
2 changed files with 28 additions and 7 deletions

View File

@ -4,12 +4,11 @@
* *
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 1.6.4 * @version 2.1.0
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
global $woocommerce; ?>
<?php wc_print_messages(); ?> <?php wc_print_messages(); ?>
@ -26,6 +25,9 @@ global $woocommerce; ?>
<h2><?php _e( 'Login', 'woocommerce' ); ?></h2> <h2><?php _e( 'Login', 'woocommerce' ); ?></h2>
<form method="post" class="login"> <form method="post" class="login">
<?php do_action( 'woocommerce_login_form_start' ); ?>
<p class="form-row form-row-wide"> <p class="form-row form-row-wide">
<label for="username"><?php _e( 'Username or email address', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="username"><?php _e( 'Username or email address', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="username" id="username" /> <input type="text" class="input-text" name="username" id="username" />
@ -34,6 +36,9 @@ global $woocommerce; ?>
<label for="password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input class="input-text" type="password" name="password" id="password" /> <input class="input-text" type="password" name="password" id="password" />
</p> </p>
<?php do_action( 'woocommerce_login_form' ); ?>
<p class="form-row"> <p class="form-row">
<?php wp_nonce_field( 'woocommerce-login' ) ?> <?php wp_nonce_field( 'woocommerce-login' ) ?>
<input type="submit" class="button" name="login" value="<?php _e( 'Login', 'woocommerce' ); ?>" /> <input type="submit" class="button" name="login" value="<?php _e( 'Login', 'woocommerce' ); ?>" />
@ -44,6 +49,9 @@ global $woocommerce; ?>
<p class="lost_password"> <p class="lost_password">
<a href="<?php echo esc_url( woocommerce_get_endpoint_url( 'lost-password', '', get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) ); ?>"><?php _e( 'Lost your password?', 'woocommerce' ); ?></a> <a href="<?php echo esc_url( woocommerce_get_endpoint_url( 'lost-password', '', get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) ); ?>"><?php _e( 'Lost your password?', 'woocommerce' ); ?></a>
</p> </p>
<?php do_action( 'woocommerce_login_form_end' ); ?>
</form> </form>
<?php if (get_option('woocommerce_enable_myaccount_registration')=='yes') : ?> <?php if (get_option('woocommerce_enable_myaccount_registration')=='yes') : ?>
@ -56,6 +64,8 @@ global $woocommerce; ?>
<form method="post" class="register"> <form method="post" class="register">
<?php do_action( 'woocommerce_register_form_start' ); ?>
<?php if ( get_option( 'woocommerce_registration_generate_username' ) == 'no' ) : ?> <?php if ( get_option( 'woocommerce_registration_generate_username' ) == 'no' ) : ?>
<p class="form-row form-row-wide"> <p class="form-row form-row-wide">
@ -78,12 +88,16 @@ global $woocommerce; ?>
<!-- Spam Trap --> <!-- Spam Trap -->
<div style="left:-999em; position:absolute;"><label for="trap"><?php _e( 'Anti-spam', 'woocommerce' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" /></div> <div style="left:-999em; position:absolute;"><label for="trap"><?php _e( 'Anti-spam', 'woocommerce' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>
<?php do_action( 'woocommerce_register_form' ); ?>
<?php do_action( 'register_form' ); ?> <?php do_action( 'register_form' ); ?>
<p class="form-row"> <p class="form-row">
<?php wp_nonce_field( 'woocommerce-register', 'register') ?> <?php wp_nonce_field( 'woocommerce-register', 'register') ?>
<input type="submit" class="button" name="register" value="<?php _e( 'Register', 'woocommerce' ); ?>" /> <input type="submit" class="button" name="register" value="<?php _e( 'Register', 'woocommerce' ); ?>" />
</p> </p>
<?php do_action( 'woocommerce_register_form_end' ); ?>
</form> </form>
</div> </div>

View File

@ -4,16 +4,18 @@
* *
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 1.6.4 * @version 2.1.0
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce; if ( is_user_logged_in() )
return;
if (is_user_logged_in()) return;
?> ?>
<form method="post" class="login" <?php if ( $hidden ) echo 'style="display:none;"'; ?>> <form method="post" class="login" <?php if ( $hidden ) echo 'style="display:none;"'; ?>>
<?php do_action( 'woocommerce_login_form_start' ); ?>
<?php if ( $message ) echo wpautop( wptexturize( $message ) ); ?> <?php if ( $message ) echo wpautop( wptexturize( $message ) ); ?>
<p class="form-row form-row-first"> <p class="form-row form-row-first">
@ -26,6 +28,8 @@ if (is_user_logged_in()) return;
</p> </p>
<div class="clear"></div> <div class="clear"></div>
<?php do_action( 'woocommerce_login_form' ); ?>
<p class="form-row"> <p class="form-row">
<?php wp_nonce_field( 'woocommerce-login' ) ?> <?php wp_nonce_field( 'woocommerce-login' ) ?>
<input type="submit" class="button" name="login" value="<?php _e( 'Login', 'woocommerce' ); ?>" /> <input type="submit" class="button" name="login" value="<?php _e( 'Login', 'woocommerce' ); ?>" />
@ -39,4 +43,7 @@ if (is_user_logged_in()) return;
</p> </p>
<div class="clear"></div> <div class="clear"></div>
<?php do_action( 'woocommerce_login_form_end' ); ?>
</form> </form>