How To Easily Rebuild The Custom Field Cache On xenForo. To build back cache is actually very easy to do, but for beginners who wear xenforo forum will usually be difficult. Therefore, I will share a tutorial how to build a cache back properly on the forum xenforo. Take the tour which I will share below correctly and appropriately.
All the custom fields for the users are stored in a couple of places.\
- 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.
RebuildCustomFields.php
<?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); }
It is How To Easily Rebuild The Custom Field Cache On xenForo, good luck!
Title: How To Easily Rebuild The Custom Field Cache On xenForo
Posted by:
Published :2013-09-02T10:00:00-07:00
How To Easily Rebuild The Custom Field Cache On xenForo
Related articles:
Posted by:
Published :2013-09-02T10:00:00-07:00
How To Easily Rebuild The Custom Field Cache On xenForo
thanks! helped me out so much
ReplyDelete