Tweak account options
This commit is contained in:
parent
c8d07b076b
commit
ef49fd62df
|
@ -138,7 +138,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
|
||||
array(
|
||||
'title' => __( 'Registration', 'woocommerce' ),
|
||||
'desc' => __( 'Allow registration on the checkout page', 'woocommerce' ),
|
||||
'desc' => __( 'Enable registration on the "Checkout" page', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_signup_and_login_from_checkout',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
|
@ -146,7 +146,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Allow registration on the "My Account" page', 'woocommerce' ),
|
||||
'desc' => __( 'Enable registration on the "My Account" page', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_myaccount_registration',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
|
@ -154,8 +154,16 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Register using the email address for the username', 'woocommerce' ),
|
||||
'id' => 'woocommerce_registration_email_for_username',
|
||||
'desc' => __( 'Automatically generate username from customer email', 'woocommerce' ),
|
||||
'id' => 'woocommerce_registration_generate_username',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => ''
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Automatically generate customer password', 'woocommerce' ),
|
||||
'id' => 'woocommerce_registration_generate_password',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end'
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1281,6 +1281,12 @@ p.demo_store {
|
|||
clear:left;
|
||||
}
|
||||
}
|
||||
.create-account small {
|
||||
font-size: 11px;
|
||||
color: @subtext;
|
||||
line-height: 13px;
|
||||
font-weight:normal;
|
||||
}
|
||||
div.shipping-address {
|
||||
padding: 0;
|
||||
clear:left;
|
||||
|
|
|
@ -57,30 +57,21 @@ class WC_Checkout {
|
|||
$this->checkout_fields['billing'] = $woocommerce->countries->get_address_fields( $this->get_value('billing_country'), 'billing_' );
|
||||
$this->checkout_fields['shipping'] = $woocommerce->countries->get_address_fields( $this->get_value('shipping_country'), 'shipping_' );
|
||||
|
||||
if ( get_option( 'woocommerce_registration_email_for_username' ) == 'no' ) {
|
||||
|
||||
if ( get_option( 'woocommerce_registration_generate_username' ) == 'no' ) {
|
||||
$this->checkout_fields['account']['account_username'] = array(
|
||||
'type' => 'text',
|
||||
'label' => __( 'Account username', 'woocommerce' ),
|
||||
'placeholder' => _x( 'Username', 'placeholder', 'woocommerce' )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$this->checkout_fields['account']['account_password'] = array(
|
||||
'type' => 'password',
|
||||
'label' => __( 'Account password', 'woocommerce' ),
|
||||
'placeholder' => _x( 'Password', 'placeholder', 'woocommerce' ),
|
||||
'class' => array( 'form-row-first' )
|
||||
);
|
||||
|
||||
$this->checkout_fields['account']['account_password-2'] = array(
|
||||
'type' => 'password',
|
||||
'label' => __( 'Confirm password', 'woocommerce' ),
|
||||
'placeholder' => _x( 'Confirm password', 'placeholder', 'woocommerce' ),
|
||||
'class' => array( 'form-row-last' ),
|
||||
'label_class' => array( 'hidden' )
|
||||
);
|
||||
if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) {
|
||||
$this->checkout_fields['account']['account_password'] = array(
|
||||
'type' => 'password',
|
||||
'label' => __( 'Account password', 'woocommerce' ),
|
||||
'placeholder' => _x( 'Password', 'placeholder', 'woocommerce' )
|
||||
);
|
||||
}
|
||||
|
||||
$this->checkout_fields['order'] = array(
|
||||
'order_comments' => array(
|
||||
|
@ -572,9 +563,6 @@ class WC_Checkout {
|
|||
if ( empty($this->posted['account_password']) )
|
||||
$woocommerce->add_error( __( 'Please enter an account password.', 'woocommerce' ) );
|
||||
|
||||
if ( $this->posted['account_password-2'] !== $this->posted['account_password'] )
|
||||
$woocommerce->add_error( __( 'Passwords do not match.', 'woocommerce' ) );
|
||||
|
||||
// Check the e-mail address
|
||||
if ( email_exists( $this->posted['billing_email'] ) )
|
||||
$woocommerce->add_error( __( 'An account is already registered with your email address. Please login.', 'woocommerce' ) );
|
||||
|
|
|
@ -32,35 +32,35 @@ global $woocommerce;
|
|||
|
||||
<?php do_action('woocommerce_after_checkout_billing_form', $checkout ); ?>
|
||||
|
||||
|
||||
|
||||
<?php if ( ! is_user_logged_in() && $checkout->enable_signup ) : ?>
|
||||
|
||||
<?php if ( $checkout->enable_guest_checkout ) {
|
||||
$checked_value = ( true === $checkout->get_value('createaccount') || ( true === apply_filters( 'woocommerce_create_account_default_checked', false ) ) );
|
||||
?>
|
||||
<?php if ( $checkout->enable_guest_checkout ) : ?>
|
||||
|
||||
<p class="form-row form-row-wide">
|
||||
<input class="input-checkbox" id="createaccount" <?php checked( $checked_value, true) ?> type="checkbox" name="createaccount" value="1" /> <label for="createaccount" class="checkbox"><?php _e( 'Create an account?', 'woocommerce' ); ?></label>
|
||||
<p class="form-row form-row-wide create-account">
|
||||
<input class="input-checkbox" id="createaccount" <?php checked( ( true === $checkout->get_value('createaccount') || ( true === apply_filters( 'woocommerce_create_account_default_checked', false ) ) ), true) ?> type="checkbox" name="createaccount" value="1" /> <label for="createaccount" class="checkbox"><?php _e( 'Create an account?', 'woocommerce' ); ?></label>
|
||||
</p>
|
||||
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_before_checkout_registration_form', $checkout ); ?>
|
||||
|
||||
<div class="create-account">
|
||||
<?php if ( ! empty( $checkout->checkout_fields['account'] ) ) : ?>
|
||||
|
||||
<p><?php _e( 'Create an account by entering the information below. If you are a returning customer please login at the top of the page.', 'woocommerce' ); ?></p>
|
||||
<div class="create-account">
|
||||
|
||||
<?php foreach ($checkout->checkout_fields['account'] as $key => $field) : ?>
|
||||
<p><?php _e( 'Create an account by entering the information below. If you are a returning customer please login at the top of the page.', 'woocommerce' ); ?></p>
|
||||
|
||||
<?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
|
||||
<?php foreach ( $checkout->checkout_fields['account'] as $key => $field ) : ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
|
||||
|
||||
<div class="clear"></div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>
|
||||
|
||||
|
|
Loading…
Reference in New Issue