I have a question regarding xf_forum.last_thread_prefix_id.
As far as I understand, XenForo stores the prefix of the last thread in a forum in the last_thread_prefix_id column of xf_forum.
Is it correct that XenForo does not automatically update this field if someone edits a thread and changes only its prefix_id, without changing last_post_date, reply_count, title, or discussion_type?
In other words:
If the most recently updated thread in a forum has its prefix changed, can xf_forum.last_thread_prefix_id become outdated because XenForo does not recalculate it in that situation?
If that is the case, is this the reason why an add-ons like Prefix Essentials include code like this to force an update?
I would like to understand whether this is working around a core limitation, or whether this field should already be handled correctly by XenForo itself.
As far as I understand, XenForo stores the prefix of the last thread in a forum in the last_thread_prefix_id column of xf_forum.
Is it correct that XenForo does not automatically update this field if someone edits a thread and changes only its prefix_id, without changing last_post_date, reply_count, title, or discussion_type?
In other words:
If the most recently updated thread in a forum has its prefix changed, can xf_forum.last_thread_prefix_id become outdated because XenForo does not recalculate it in that situation?
If that is the case, is this the reason why an add-ons like Prefix Essentials include code like this to force an update?
PHP:
protected function updateForumRecord()
{
parent::updateForumRecord();
if (($forum = $this->Forum)
&& $this->discussion_state === 'visible'
&& $this->isChanged('prefix_id')
&& !$this->isChanged(['last_post_date', 'reply_count', 'title', 'discussion_type'])
) {
$forum->last_thread_prefix_id = $this->prefix_id;
$forum->save();
}
}
I would like to understand whether this is working around a core limitation, or whether this field should already be handled correctly by XenForo itself.