Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › login / register form
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › login / register form
- This topic has 14 replies, 5 voices, and was last updated 11 years by laranz – SUPPORT.
-
Posted in: Neighborhood
-
September 5, 2013 at 10:40 pm #20192
HI team,
I have to create a custom form for registeration , I do see you have used contact form 7 , used it in past and love working with it.
I need to know where do I customize this page / form ?
September 6, 2013 at 2:35 pm #20331Hi,
You need to go to woocommerce\myaccount\form-login.php
Thanks,
laranz.September 11, 2013 at 7:54 pm #21298so i need to enter fields into the php directly? , is there a ways I can create the form on COntact form-7 plugin and add shortcode to the page ?
September 11, 2013 at 8:04 pm #21300Can I add shortcode for contact form7 here in the themeoptions>woocommerce options page
September 12, 2013 at 3:43 pm #21489You can try that, yeah
October 17, 2013 at 12:05 am #27027the short code doesnot work inthe themeoptions page . what is my next option
how can I create a custome registeration form ( probably using Contactform 7)
October 18, 2013 at 9:38 am #27229Hi,
Actually what you try to achieve? Contact form 7 is not used for registration purpose.
Thanks,
laranz.November 15, 2013 at 1:43 pm #31573where do we select what fields we need for the registration?
November 18, 2013 at 10:20 am #31855Do you mean the fields that are shown once you click “register” on this page? http://neighborhood.swiftideas.net/my-account/
November 18, 2013 at 8:59 pm #31978Yes that was my original question too. how to configure or add additional fields in this section?
November 18, 2013 at 9:00 pm #31979This reply has been marked as private.November 20, 2013 at 1:57 pm #32311Hi!
This sure is possible, but I’m afraid it’s not built into the theme and would have to be modified especially for you. We’d love to help you with this customization but we are only able to provide support for basic theme issues and bug fixes. We do provide support for small customizations but unfortunately this request is beyond that. Please see our general policy and guidelines for more info. You could also hire a developer to help you with your customizations.
Thank you for understanding!
Cheers!November 30, 2013 at 5:45 pm #34576I also need to add more fields for new customers to provide more information during registration. At the very, least they should be able to enter an address to register.
At the moment, there isn’t enough information, no option to include a captcha to avoid bots setting up multiple accounts, and also no way for the user to confirm their email address before the account is activated.
I can totally understand if @swiftideas is unable to implement this feature, but it would be useful to know what files need to be changed and how to change them, so we do it ourselves…
In the meantime, I will keep looking for a solution to this issue and update this thread if I find one.
November 30, 2013 at 8:10 pm #34591I’ve figured out a workaround… I hope this helps you guys. Let me know if it does or doesn’t work for you…
STEP 1
Add the code below into your CHILD THEME’s functions.php file. It includes the function that saves the user’s first and last name into the database.//Validation registration form after submission using the filter registration_errors add_filter('registration_errors', 'registration_errors_validation', 10,3); function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) { global $woocommerce; extract($_POST); // extracting $_POST into separate variables if(($firstname == '' ) || ($lastname == '' )) { $woocommerce->add_error( __( 'Please, fill in all the required fields.', 'woocommerce' ) ); } return $reg_errors; } //Updating use meta after registration successful registration add_action('woocommerce_created_customer','adding_extra_reg_fields'); function adding_extra_reg_fields($user_id) { extract($_POST); update_user_meta($user_id, 'first_name', $firstname); update_user_meta($user_id, 'last_name', $lastname); // can also do multiple fields like that update_user_meta($user_id, 'first_name', $firstname); update_user_meta($user_id, 'billing_first_name', $firstname); update_user_meta($user_id, 'shipping_first_name', $firstname); update_user_meta($user_id, 'last_name', $lastname); update_user_meta($user_id, 'billing_last_name', $lastname); update_user_meta($user_id, 'shipping_last_name', $lastname); }
STEP 2
Using your FTP client or hosting server’s file manager, create a “woocommerce” folder in your child theme directory. Open the woocommerce folder you just created, and add a new folder named “myaccount”. The final directory path should look something like this: wp-content/themes/your-child-theme/woocommerce/myaccount/STEP 3
Inside the wp-content/themes/your-child-theme/woocommerce/myaccount/ directory, create a php file and name it “form-login.php”.STEP 4
In the form-login.php file you just created, paste in the following code which adds the user’s first name and last name to the registration form.<?php /** * Login Form * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $woocommerce; $options = get_option('sf_neighborhood_options'); ?> <?php $woocommerce->show_messages(); ?> <?php do_action('woocommerce_before_customer_login_form'); ?> <div class="my-account-login-wrap"> <div class="col2-set" id="customer_login"> <div class="col-1"> <div class="login-wrap"> <h4 class="lined-heading"><span><?php _e( 'Registered customers', 'swiftframework' ); ?></span></h4> <form method="post" class="login"> <p class="form-row form-row-first"> <label for="username"><?php _e( 'Username or email', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="username" id="username" /> </p> <p class="form-row form-row-last"> <label for="password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label> <input class="input-text" type="password" name="password" id="password" /> </p> <div class="clear"></div> <p class="form-row"> <?php $woocommerce->nonce_field('login', 'login') ?> <input type="submit" class="button" name="login" value="<?php _e( 'Login', 'woocommerce' ); ?>" /> <a class="lost_password" href="<?php $lost_password_page_id = woocommerce_get_page_id( 'lost_password' ); if ( $lost_password_page_id ) echo esc_url( get_permalink( $lost_password_page_id ) ); else echo esc_url( wp_lostpassword_url( home_url() ) ); ?>"><?php _e( 'Lost Password?', 'woocommerce' ); ?></a> </p> </form> </div> </div> <?php if (get_option('woocommerce_enable_myaccount_registration')=='yes') : ?> <div class="col-2"> <h4 class="lined-heading"><span><?php _e( 'Not registered? No problem', 'swiftframework' ); ?></span></h4> <div class="new-user-text"><?php echo $options['checkout_new_account_text']; ?></div> <a class="sf-roll-button alt-button create-account-button" href="#create-account" data-toggle="modal"><span><?php _e('Create an account', 'swiftframework'); ?></span><span><?php _e('Create an account', 'swiftframework'); ?></span></a> <form method="post" class="register"> <div id="create-account" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="create-account-modal" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="create-account-modal"><?php _e("Register", "swiftframework"); ?></h3> </div> <div class="modal-body"> <?php if ( get_option( 'woocommerce_registration_email_for_username' ) == 'no' ) : ?> <p class="form-row form-row-first"> <label for="reg_username"><?php _e( 'Username', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="username" id="reg_username" value="<?php if (isset($_POST['username'])) echo esc_attr($_POST['username']); ?>" /> </p> <p class="form-row form-row-last"> <?php else : ?> <p class="form-row form-row-wide"> <?php endif; ?> <!-- Start of code that adds first and last name to the forms --> <div class="form-row form-row-wide"><label for="reg_firstname"><?php _e('First Name', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="firstname" id="reg_firstname" size="40" value="<?php if (isset($_POST['firstname'])) echo esc_attr($_POST['firstname']); ?>"/></div> <div class="form-row form-row-wide"><label for="reg_lastname"><?php _e('Last Name', 'woocommerce'); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="lastname" id="reg_lastname" size="40" value="<?php if (isset($_POST['lastname'])) echo esc_attr($_POST['lastname']); ?>" /></div> <div class="form-row form-row-wide"> <!-- End of code that adds first and last name to the forms, but also added a close div after the email section below for formatting purposes --> <label for="reg_email"><?php _e( 'Email', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="email" class="input-text" name="email" id="reg_email" value="<?php if (isset($_POST['email'])) echo esc_attr($_POST['email']); ?>" /></div> </p> <div class="clear"></div> <p class="form-row form-row-first"> <label for="reg_password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="password" class="input-text" name="password" id="reg_password" value="<?php if (isset($_POST['password'])) echo esc_attr($_POST['password']); ?>" /> </p> <p class="form-row form-row-last"> <label for="reg_password2"><?php _e( 'Re-enter password', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="password" class="input-text" name="password2" id="reg_password2" value="<?php if (isset($_POST['password2'])) echo esc_attr($_POST['password2']); ?>" /> </p> <div class="clear"></div> <!-- Spam Trap --> <div style="left:-999em; position:absolute;"><label for="trap">Anti-spam</label><input type="text" name="email_2" id="trap" tabindex="-1" /></div> <?php do_action( 'register_form' ); ?> <?php $woocommerce->nonce_field('register', 'register') ?> <input type="submit" class="button" name="register" value="<?php _e( 'Register', 'woocommerce' ); ?>" /> </div> </div> </form> </div> <?php endif; ?> </div> </div> <?php do_action('woocommerce_after_customer_login_form'); ?>
<hl>
What this does is include the first and last name fields during registration, and saves them to the corresponding fields in the user’s shipping and billing address. Obviously you should be able to follow the pattern and include the other fields as well, such as address, postcode, etc.I really hope this helps. Let me know if it works for you!!
December 2, 2013 at 12:54 pm #34723Hi @icr8,
Thanks for the tip. Yes you can customize the woocommerce to add extra fields. I keep this for other users if they want it.
Thanks,
laranz. -
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.