Lack of interest Add new method to handle user for XenForo_Deferred_User

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

Milano

Well-known member
Currently I want to extend XenForo_Deferred_User and add my own rebuild feature, but doing so, I have to duplicate the code from the execute method to fetch the users, meaning that the code will be run twice. Maybe separates these lines of code to a new method could be better just like preparePost, prepareThread, prepareUser, etc inside models.

PHP:
$userDw = XenForo_DataWriter::create('XenForo_DataWriter_User', XenForo_DataWriter::ERROR_SILENT);
if ($userDw->setExistingData($userId))
{
    XenForo_Db::beginTransaction();

    $userDw->set('alerts_unread', $userModel->getUnreadAlertsCount($userId));
    $userDw->set('conversations_unread', $conversationModel->countUnreadConversationsForUser($userId));
    $userDw->save();
    $userDw->rebuildUserGroupRelations();
    $userDw->rebuildPermissionCombinationId();
    $userDw->rebuildDisplayStyleGroupId();
    $userDw->rebuildCustomFields();
    $userDw->rebuildIgnoreCache();

    XenForo_Db::commit();
}
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
Top Bottom