sign up
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
6 changed files
with
75 additions
and
1 deletions
| ... | @@ -14949,6 +14949,7 @@ input[type=checkbox] { | ... | @@ -14949,6 +14949,7 @@ input[type=checkbox] { |
| 14949 | all: unset; | 14949 | all: unset; |
| 14950 | width: 100%; | 14950 | width: 100%; |
| 14951 | margin: auto; | 14951 | margin: auto; |
| 14952 | border-width: 0px 0px 1px 0px !important; | ||
| 14952 | border-bottom: 1px solid #2c2c2c; | 14953 | border-bottom: 1px solid #2c2c2c; |
| 14953 | } | 14954 | } |
| 14954 | .search:not(body) .search-form .search-submit { | 14955 | .search:not(body) .search-form .search-submit { | ... | ... |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
| ... | @@ -129,4 +129,75 @@ function certs(){ | ... | @@ -129,4 +129,75 @@ function certs(){ |
| 129 | }catch(Throwable $e) { | 129 | }catch(Throwable $e) { |
| 130 | error_log("certs()". $e->getMessage()) ; | 130 | error_log("certs()". $e->getMessage()) ; |
| 131 | } | 131 | } |
| 132 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 132 | } | ||
| 133 | |||
| 134 | function wooc_extra_register_fields() {?> | ||
| 135 | <p class="form-row form-row-first"> | ||
| 136 | <label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?><span class="required">*</span></label> | ||
| 137 | <input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" /> | ||
| 138 | </p> | ||
| 139 | <p class="form-row form-row-last"> | ||
| 140 | <label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?><span class="required">*</span></label> | ||
| 141 | <input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" /> | ||
| 142 | </p> | ||
| 143 | <div class="clear"></div> | ||
| 144 | <?php | ||
| 145 | } | ||
| 146 | add_action( 'woocommerce_register_form_start', 'wooc_extra_register_fields' ); | ||
| 147 | |||
| 148 | |||
| 149 | function wooc_validate_extra_register_fields( $username, $email, $validation_errors ) { | ||
| 150 | if ( isset( $_POST['billing_first_name'] ) && empty( $_POST['billing_first_name'] ) ) { | ||
| 151 | $validation_errors->add( 'billing_first_name_error', __( '<strong>Error</strong>: First name is required!', 'woocommerce' ) ); | ||
| 152 | } | ||
| 153 | if ( isset( $_POST['billing_last_name'] ) && empty( $_POST['billing_last_name'] ) ) { | ||
| 154 | $validation_errors->add( 'billing_last_name_error', __( '<strong>Error</strong>: Last name is required!.', 'woocommerce' ) ); | ||
| 155 | } | ||
| 156 | return $validation_errors; | ||
| 157 | } | ||
| 158 | add_action( 'woocommerce_register_post', 'wooc_validate_extra_register_fields', 10, 3 ); | ||
| 159 | |||
| 160 | /** | ||
| 161 | * Below code save extra fields. | ||
| 162 | */ | ||
| 163 | function wooc_save_extra_register_fields( $customer_id ) { | ||
| 164 | if ( isset( $_POST['billing_phone'] ) ) { | ||
| 165 | // Phone input filed which is used in WooCommerce | ||
| 166 | update_user_meta( $customer_id, 'billing_phone', sanitize_text_field( $_POST['billing_phone'] ) ); | ||
| 167 | } | ||
| 168 | if ( isset( $_POST['billing_first_name'] ) ) { | ||
| 169 | //First name field which is by default | ||
| 170 | update_user_meta( $customer_id, 'first_name', sanitize_text_field( $_POST['billing_first_name'] ) ); | ||
| 171 | // First name field which is used in WooCommerce | ||
| 172 | update_user_meta( $customer_id, 'billing_first_name', sanitize_text_field( $_POST['billing_first_name'] ) ); | ||
| 173 | } | ||
| 174 | if ( isset( $_POST['billing_last_name'] ) ) { | ||
| 175 | // Last name field which is by default | ||
| 176 | update_user_meta( $customer_id, 'last_name', sanitize_text_field( $_POST['billing_last_name'] ) ); | ||
| 177 | // Last name field which is used in WooCommerce | ||
| 178 | update_user_meta( $customer_id, 'billing_last_name', sanitize_text_field( $_POST['billing_last_name'] ) ); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | add_action( 'woocommerce_created_customer', 'wooc_save_extra_register_fields' ); | ||
| 182 | |||
| 183 | add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3); | ||
| 184 | function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) { | ||
| 185 | global $woocommerce; | ||
| 186 | extract( $_POST ); | ||
| 187 | |||
| 188 | if ( strcmp( $password, $password2 ) !== 0 ) { | ||
| 189 | return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) ); | ||
| 190 | } | ||
| 191 | return $reg_errors; | ||
| 192 | } | ||
| 193 | |||
| 194 | add_action( 'woocommerce_register_form', 'wc_register_form_password_repeat' ); | ||
| 195 | function wc_register_form_password_repeat() { | ||
| 196 | ?> | ||
| 197 | <p class="form-row form-row-wide"> | ||
| 198 | <label for="reg_password2"><?php _e( 'Password Repeat', 'woocommerce' ); ?> <span class="required">*</span></label> | ||
| 199 | <input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password2" id="reg_password2" value="<?php if ( ! empty( $_POST['password2'] ) ) echo esc_attr( $_POST['password2'] ); ?>" /> | ||
| 200 | </p> | ||
| 201 | <?php | ||
| 202 | } | ||
| 203 | ?> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -280,7 +280,9 @@ | ... | @@ -280,7 +280,9 @@ |
| 280 | all: unset; | 280 | all: unset; |
| 281 | width: 100%; | 281 | width: 100%; |
| 282 | margin: auto; | 282 | margin: auto; |
| 283 | border-width: 0px 0px 1px 0px !important; | ||
| 283 | border-bottom:1px solid #2c2c2c; | 284 | border-bottom:1px solid #2c2c2c; |
| 285 | |||
| 284 | 286 | ||
| 285 | } | 287 | } |
| 286 | 288 | ... | ... |
-
Please register or sign in to post a comment