setting user attribute programmatically - multiple selects

Permalink
Hi, I have a user attribute called 'colors'. It is a 'select' attribute with "allow multiple values" to be selected... I can access this attribute via:
$colors = $ui->getAttribute('colours');

I want to be able to set this attribute programmatically with multiple values... The values for the attribute are black, white, grey, blue, green, yellow, orange & red.

I can set the attribute for one value using:
$ui->setAttribute('colours', 'blue');

but I cannot find a way to set ALL of the colours...

Can anyone help me out?

Thanks

rc255
 
hutman replied on at Permalink Reply
hutman
You should be able to pass in an array like this

$ui->setAttribute('colours', array('blue', 'green'));
rc255 replied on at Permalink Reply
rc255
Brilliant, that did the trick!

Thanks Hutman :)