Collecting Country/City Data

Discussion in 'Customization & add-ons' started by mumser101, Jan 13, 2010.

  1. mumser101

    mumser101 New Member

    Joined:
    Oct 1, 2009
    Messages:
    26
    We'd like to collect the country and city so we can mail members about local happenings. However, the only option seems to be to turn on all the address fields. Anyone using only selected address fields? And how do you do it?

    Thanks.
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    You can enable address info then remove not required fields from signup template and aslo modify this function in member.inc.php
    Code:
    function vsf_address($vars){
        $err = array();
        if ($vars['street'] == '')
            $err[] = _SIGNUP_ENTER_STREET;
        if ($vars['city'] == '')
            $err[] = _SIGNUP_ENTER_CITY;
        if (($vars['country'] == 'US' || $vars['country'] == 'CA') && ($vars['state'
            $err[] = _SIGNUP_ENTER_STATE;
        if ($vars['zip'] == '')
            $err[] = _SIGNUP_ENTER_ZIP;
        if ($vars['country'] == '')
            $err[] = _SIGNUP_ENTER_COUNTRY;
        return $err;
    }
    
    
    to
    Code:
    function vsf_address($vars){
        $err = array();
        if (($vars['country'] == 'US' || $vars['country'] == 'CA') && ($vars['state'
            $err[] = _SIGNUP_ENTER_STATE;
        if ($vars['country'] == '')
            $err[] = _SIGNUP_ENTER_COUNTRY;
        return $err;
    }
    
    
  3. mumser101

    mumser101 New Member

    Joined:
    Oct 1, 2009
    Messages:
    26
    Thanks, that looks simple enough. Will give it a try today.

Share This Page