Programmatically Updating User Attributes Not Showing in C5

Permalink
Any ideas on why when programmatically updating the UserSearchIndexAttributes table through a custom built package the front-end user attributes don't reflect the details stored?

If I update the user attributes within the search user front-end the corresponding table columns are updated within the UserSearchIndexAttributes database table but doing it the other way round appears to have no effect.

Really struggling to make sense of this... Is there another table I need to update in the process?

Couple of screenshots attached.

(clearing the cache has no effect either)

1 Attachment

simonknibbs
 
Mainio replied on at Permalink Reply
Mainio
The attributes system in concrete5 is somewhat more complex than just a single database table. Therefore, it's not enough that you update that table solely.

If you need to update a user attribute, that needs to happen through the "UserInfo" object:
$ui = UserInfo::getByID($uID);
$ui->setAttribute('attribute_handle', 'attribute_value');


Here's a bit more technical information about the attributes:
http://www.concrete5.org/documentation/how-tos/developers/create-a-...

It's actually a guide on making a custom attribute type but learning it can help you learn the whole system behind. It consists of multiple parts.

The tables that end with "SearchIndexAttributes" are just tables that store the values of these attributes in one table for easier searches. When you update an attribute, it updates its actual value and also the search indexed value.