Updating users attributes from a script

Permalink
Hi, I need to update users attributes from a script.
"Scripting Common concrete5 Tasks" tells me how to update user groups, etc., but not attributes.
Data from the text box attribute can be read by following code.

<?php
$ui = UserInfo::getByID(1);
echo $ui->getUserMysample();
?>


But how do I update the user attribute using a php script?
Any help is appreciated, thanks.

griebel
 
Tony replied on at Permalink Reply
Tony
$th = Loader::helper('text');
$ui = UserInfo::getById(1);
$ui->setAttribute('uFirstName', $th->sanitize($this->post('uFirstName'), 100));

(the sanitize is optional)
griebel replied on at Permalink Reply
griebel
Great, your my online Concrete5 Hero ;)