requiring fields in "address info"

Discussion in 'Customization & add-ons' started by Sinclair, May 29, 2004.

  1. Sinclair

    Sinclair Guest

    I've created a number of required fields using the Add Fields function - however the Address Info that I chose to include in the Signup Form already existed - I chose to inlcude it in the form via a checkbox inthe control panel - I would like to make this information (at leas the state) required - but can't seem to find the option.

    I realize I could recreate the fields form scratch and make them required in the Add Fields panel - but I would prefer just to leave the fields as they are - so as not to have to re-enter or import the users addresses to the new fields.

    Is there an option to require the pre-generated Address Info int he Signup Form?
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    I've sent you custom code, this code will be added to version 2.1.9
  3. Sinclair

    Sinclair Guest

    Thanks again, Alex!
  4. michaeltran

    michaeltran Guest

    Alex, could you also send me that quoteto make address info at signup form to be required?

    Thanks
  5. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    add the following code to
    amember/member.inc.php before closing ?>

    PHP:
    function vsf_address($vars){
        
    $err = array();
        if (
    $vars['street'] == ''
            
    $err[] = "Please enter street address";
        if (
    $vars['city'] == ''
            
    $err[] = "Please enter city";
        if ((
    $vars['country'] == 'US') && ($vars['state'] == '')) 
            
    $err[] = "Please choose a state";
        if (
    $vars['zip'] == ''
            
    $err[] = "Please enter ZIP code";
        if (
    $vars['country'] == ''
            
    $err[] = "Please choose a country";
        return 
    $err;       
    }
    then add the following code to bottom of amember/plugins.inc.php
    PHP:
    if ($config['use_address_info'])
        
    setup_plugin_hook('validate_signup_form''vsf_address');
  6. michaeltran

    michaeltran Guest

    Thanks Alex. It worked well

Share This Page