Requiring Address Info

Discussion in 'Templates customization' started by FC3S, Sep 10, 2003.

  1. FC3S

    FC3S Guest

    Hi,

    Is there a way to require a new subscriber to complete the address information on the sign-up page? Currently, a new subscriber is only required to enter their first name, last name, user id, and password.

    Thanks
  2. pilot

    pilot New Member

    Joined:
    May 24, 2003
    Messages:
    178
    In the AmemberPro admin, go to set up config /Global/ there is an option to use address information as a yes/no drop down. it will now appear in the sign up form.

    You may also add fields in here - there is instuctions on the forum how to do this.

    B)
  3. FC3S

    FC3S Guest

    Thanks for the response pilot. I have that enable already and the fields are visible. I was wondering if there was a way to require the user to input the address, city, state, zip, and phone before they can continue to the next step. Currently, the page only requires a new user to select a subscription type, first name, last name, user id, and password. Once these fields are completed they can move on to the next step, but I want them to be unable to continue to the next step unless these fields are completed. So, if a new user only enters the five fields mentioned above and tries to continue, they get returned to the screen and a message appears stating they must complete the blank fields. Same as what haapens when you try to signup, but do not include a name or email address, but for the address field.

    Thanks
  4. FC3S

    FC3S Guest

    <bump>
  5. alex-adm

    alex-adm Guest

    Yes, it is possible
    You can create site.inc.php file with the following content:
    Code:
    <?
    function vsf($vars){
        $err = array();
    
        /// repeat these 2 lines for all necessary fields
        if (!$vars['street'])
           $err[] = "Please enter street address";
    
    
        return $err;
    }
    setup_plugin_hook('validate_signup_form', 'vsf');
    ?>
  6. Kelsthemes

    Kelsthemes Guest

    quick question here

    /// repeat these 2 lines for all necessary fields
    if (!$vars['street'])
    $err[] = "Please enter street address";


    are these the only thing you need to repeat?
  7. alex-adm

    alex-adm Guest

    These lines works for Pro version only.
  8. Kelsthemes

    Kelsthemes Guest

    You can require that all fields be filled in on the free script if you do the following to signup.php

    blue text was already there I just added for the rest and it worked.

    if (!strlen($vars['name_f'])){
    $error[] = 'Please enter your First Name';
    }
    if (!strlen($vars['name_l'])){
    $error[] = 'Please enter your Last Name';
    }

    if (!strlen($vars['street'])){
    $error[] = 'Please enter your Street Name'; //added
    }
    if (!strlen($vars['city'])){
    $error[] = 'Please enter the name of your City'; //added

    }
    if (!strlen($vars['state'])){
    $error[] = 'Please enter the name of your State'; //added

    }
    if (!strlen($vars['zip'])xor ($vars['region'])){
    $error[] = 'Please enter your Zip code or Region'; //added
    }
    if (!strlen($vars['country'])){
    $error[] = 'Please enter the name of your Country'; //added

    }



    But Alex I can't figure out how to set in the is_male function on the form to allow gender specks. I would also like to add a way to collect date of birth.... any suggestions would be cool.
  9. alex-adm

    alex-adm Guest

    is_male field is to be removed - I don't recommend you to use it.

    unfortunately, it is impossible to add more fields to free version (however, it is easy in Pro).
  10. Rafi

    Rafi Guest

    how or where can we find the variables for these fields that we want to make mandatory. I have the pro version.
    thanks,
    rafi.
  11. alex-adm

    alex-adm Guest

    create the following file amember/site.inc.php

    Code:
    <?php
    
    setup_plugin_hook('validate_signup_form', 'site_validate_form');
    function site_validate_form(&$vars){    
       $errors = array();
        /// add the following 2 lines for every field you want to validate
        if (!$vars['street'])
            $err[] = "Please enter street address";
        /// lets validate another field 
        if (!$vars['zip'])
            $err[] = "Please enter ZIP code";
         
         return $err; 
    }          
    
    ?>
    We are going to make adding fields and validator managed from aMember CP.

Share This Page