• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Username Changes



Quick note for everybody who's not studying the code^^
Since 1.0.2 it's possible to update automatic tables, which stores the username (for example for commentstables from custom content types,..) and where it's necessary to upgrade the username

You can use the static $usernameChangeUpdates variable from the user datawriter to add your own entries which will be updated if the user gets a new username.

    * List of denormalised username fields in tables that should
    * be updated in the event that a username is changed.
    * @var array [query-key => [tablename, username-field, user-id-field]]
    public static $usernameChangeUpdates = array
        // the following fields are set at content creation time and will never change automatically
        'permanent' => array
                => array('xf_conversation_master', 'username', 'user_id'),
                => array('xf_conversation_message', 'username', 'user_id'),
                => array('xf_deletion_log', 'delete_username', 'delete_user_id'),
                => array('xf_news_feed', 'username', 'user_id'),
                => array('xf_post', 'username', 'user_id'),
                => array('xf_profile_post', 'username', 'user_id'),
                => array('xf_profile_post_comment', 'username', 'user_id'),
                => array('xf_report_comment', 'username', 'user_id'),
                => array('xf_spam_cleaner_log', 'username', 'user_id'),
                => array('xf_spam_cleaner_log', 'applying_username', 'applying_user_id'),
                => array('xf_thread', 'username', 'user_id'),
        // the following are denormalized, but will update over time as more replies etc. are added to the content
        'non-permanent' => array
                => array('xf_thread', 'last_post_username', 'last_post_user_id'),
                => array('xf_conversation_master', 'last_message_username', 'last_message_user_id'),
                => array('xf_conversation_user', 'last_message_username', 'last_message_user_id'),
                => array('xf_forum', 'last_post_username', 'last_post_user_id'),