Changing a user attribute's type

Permalink
I have a user attribute as type Number. Due to an unforeseen issue with leading zeroes, I need to change the attribute type to Text. Anyway to do this without having to recreate the attribute?

 
pmarques replied on at Permalink Reply
pmarques
Did you ever got to solve this?
marcus30 replied on at Permalink Reply
Ended up having to do it manually. I created another user attribute, then wrote a script to copy the values from the original attribute and save the values to the new one. Nothing too difficult, see below:

$ul = new UserList();
$ul->filterByGroup("Customer");
$users = $ul->get();
foreach($users as $ui){
   $old = $ui->getAttribute('ccv', $total);
   $ui->setAttribute('ccv_new', $old);
}


This probably won't work for your particular situation, but you get the idea. If you have a bunch of users, be careful with how may you update at a time. I was doing about 100 at a time, anymore than that the script would timeout.