Using Vendor Name as Username
-
Hi,
I’m overridingshortcode-registration-form
, my aim is to create a login form for my application in which there is only an input-text that can be used to register at the same time the Username and the vendor_name.I’ve created this field:
<p class="form-row form-row-wide"> <label for="wcpv-vendor-vendor-name"><?php esc_html_e( 'Username', 'woocommerce-product-vendors' ); ?> <span class="required">*</span></label> <input class="input-text" type="text" name="vendor_name" id="wcpv-vendor-name" value="<?php if ( ! empty( $_POST['vendor_name'] ) ) echo esc_attr( trim( $_POST['vendor_name'] ) ); ?>" tabindex="3" /> <em class="wcpv-field-note"><?php esc_html_e( '', 'woocommerce-product-vendors' ); ?></em> </p>
to get the username from the user, and then with this hidden field:
<input type="text" class="input-text hidden" name="username" id="wcpv-username" value="<?php $_POST['vendor_name'] ?>;" />
I’ve tried to set the username with the same value, so the user can login directly with the vendor name.
The form work partially, because if I try to submit it a second time it blocks me by saying “Sorry that vendor name already exists. Please enter a different one.”, but when I check the DB I found that the user has not been added to the
wprehu_users
table and only in the tablewprehu_term_taxonomy
a record is added with a taxonomy of “wcpv_product_vendors”.If I have two distinct inputbox for username and vendor name I can insert the record in the
wprehu_users
table, but this is not my goal.Is it possible to accomplish what I’m trying to do ?
- The topic ‘Using Vendor Name as Username’ is closed to new replies.