How to save the Address Attribute.

Permalink 2 users found helpful
So I'm still learning Concrete5, and have ran into a bit of a snag with a form I'm building. I'm posting values and using setAttribute to save the values to my attributes.

For Example:
$uo = UserInfo::getByID(intval($_GET['uID']));

$uo->setAttribute("phoneHome", $phoneHome);
$uo->setAttribute("phoneMobile", $phoneMobile);

I'm setting these two variables from the POST. These above work. The problem is that how do I save the Address attribute. I can find the value of the address and parts inside:

$attribs = UserAttributeKey::getList(true);
$addressArray = $uo->getAttribute($attribs[5]);

echo $addressArray->address1;

This above gives me the first line of the Address - Address 1

But this does not work:
$uo->setAttribute($addressArray->address1, $address1);

I've tried a number of things, including making an array of the Address Attributes and saving it. Anyway it's probably something easy, or something simply that I'm missing. I appreciate all the help.

 
Saltwater replied on at Permalink Best Answer Reply
Saltwater
This is how I've done it before:

$UserInfoObj->setAttribute('business_address',
array(
'address1'=>$street1,
'address2'=>$street2,
'city'=>$city,
'state_province'=>$state,
'country'=>'US',
'postal_code'=>$zip
));


Where business_address is the name of your address attribute. Basically you supply the various elements of the address attribute as a named array using the keys above.