Rigel Kentaurus
Well-known member
All the custom fields for the users are stored in a couple of places.
This value is recalculated when the user edits his information and clicks on "save". Another way is when you go to the Maintenance tasks in the AdminCP and "Rebuild user information"
In some cases, you might not want to rebuild all user information as that would also do posts, and any other information associated to the user. If you wanted to only rebuild the custom fields, a simple PHP file with the following code will suffice.
- The first one is the database table xf_user_field_value in which it maintains a relation between the field_id and the user_id
- The second one is a php serialized version of it, that is stored inside custom_fields in the xf_user_profile table
This value is recalculated when the user edits his information and clicks on "save". Another way is when you go to the Maintenance tasks in the AdminCP and "Rebuild user information"
In some cases, you might not want to rebuild all user information as that would also do posts, and any other information associated to the user. If you wanted to only rebuild the custom fields, a simple PHP file with the following code will suffice.
Code:
RebuildCustomFields.php
Code:
<?php
$startTime = microtime(true);
require('./library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader('./library');
XenForo_Application::initialize('./library');
XenForo_Application::set('page_start_time', $startTime);
XenForo_Application::setDebugMode(true);
$db = XenForo_Application::getDb();
$userIds = $db->fetchCol("SELECT user_id FROM xf_user");
$model = new XenForo_Model_User();
foreach ($userIds as $id)
{
print "Rebuilding $id<br/>\r\n";
$model->rebuildCustomFieldCache($id);
}