Can i add more fields in registration form

Forum Forums Pre-Sale Can i add more fields in registration form

This topic contains 8 replies, has 2 voices, and was last updated by  Zane M. Kolnik 3 years, 4 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #686 Reply

    creativehandz
    Participant

    Hello

    I want to add more fields in registration form and a check-box of terms and condition. Can i do this in pro version?

    Thanks
    Pranav

    #698 Reply

    Zane M. Kolnik
    Keymaster

    Hi,

    This is possible, but would require additional programming. These two hooks allow you to do this:

    function my_field(){
        echo '<input name="my_field" type="text" />';
    }
    add_action('zm_ajax_login_register_below_email_field', 'my_field');
    function my_field_submit( $user_id ){
        // do something with the field
        // sanitize, save, etc.
    }
    add_action('zm_ajax_login_after_successfull_registration', 'my_field_submit', $user_id );
    • This reply was modified 3 years, 5 months ago by  Zane M. Kolnik. Reason: Fixing markup formatting
    #699 Reply

    creativehandz
    Participant

    I want to add a checkbox with some text. can you please send me hook.

    i also want to put captcha above the submit button and rearrange the form fields. Please tell me how i can do it.

    #701 Reply

    Zane M. Kolnik
    Keymaster

    For the checkbox you could use this:

    Add the field

    function my_checkbox_field(){
        echo '<label for="my_checkbox_id">My label</label>';
        echo '<input name="my_checkbox_field" type="checkbox" id="my_checkbox_id" />';
    }
    add_action('zm_ajax_login_register_below_email_field', 'my_checkbox_field');

    Do something with the value

    function my_checkbox_field_submit( $user_id ){
        // do something with the field
        // sanitize, save, etc.
        $value = $_POST['my_checkbox_field']; // you'll want to do something with this value
    }
    add_action('zm_ajax_login_after_successfull_registration', 'my_checkbox_field_submit' );

    I’m not sure how difficult this would be using hooks, but there are a few. The captcha is added using the following hooks; zm_alr_pro_above_login_button, zm_alr_pro_above_register_button. You can see the usage in pro/google-recaptcha/register.php.

    Whats the order you would like to put the fields in? I could provide more detail, and possibly a sample.

    #702 Reply

    creativehandz
    Participant

    My Registration form order is
    1. username
    2. Email
    3. Password
    4. confirm password
    5. Checkbox
    6. Captcha
    7. Register button
    8. Already Register link

    Can you please provide me the hook in this order.

    #704 Reply

    creativehandz
    Participant

    My Registration form order is
    1. username
    2. Email
    3. Password
    4. confirm password
    5. Checkbox
    6. Captcha
    7. Register button
    8. Already Register link

    Can you please provide me the hook in this order.

    #705 Reply

    Zane M. Kolnik
    Keymaster

    Hi,

    In order to do this you’ll want to use the hook zm_alr_register_form, which takes one parameter, the $form. Honestly the easiest way is to just copy/past the form from the core file into your action. I’ve gone ahead and created a public gist for you 🙂 which has the form in the order you want.

    You may want to adjust the CSS as needed.

    Let me know if you have any additional questions.

    #709 Reply

    creativehandz
    Participant

    Thanks for the above hook. I have used it. but captcha is still below the Already Register link. i want it on above Register button.
    Please check.
    http://f67.a1c.myftpupload.com/

    here i am using pro plugin.

    #712 Reply

    Zane M. Kolnik
    Keymaster

    Can you share your code? Just use the “code” button in the editor, or place it between back ticks.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Can i add more fields in registration form