找回密码
 快速注册
搜索
查看: 42|回复: 0

编辑主题标题后更新首页标题

[复制链接]

3149

主题

8387

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65396
QQ

显示全部楼层

hbghlyj 发表于 2023-3-28 19:02 |阅读模式
hbghlyj 发表于 2023-2-21 17:48
编辑主题标题后, 更新了帖子列表页标题, 但未更新首页标题.
只有当新回帖时, 才会更新首页标题. ...


帖子列表页标题是按主题号(tid)存储的, 而“首页标题”是按版块(forum)存储的, 所以没有被一同更新. 每个forum有一个fid号和一个最后回帖(lastpost), 最后回帖有一个标题.

source/class/model/model_forum_post.php第68行开始的函数newreply中, 从261行开始的6行
$lastpost = $this->thread['tid']."\t".$this->thread['subject']."\t".getglobal('timestamp')."\t".$author;
C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost));
C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 1, 1);
if($this->forum['type'] == 'sub') {
        C::t('forum_forum')->update($this->forum['fup'], array('lastpost' => $lastpost));
}
当新回帖时, 以上会更新每个版块(forum)的最后回复的主题(lastpost)的作者(author)、时间戳(timestamp)、标题(subject).

如果把这些代码加入到第333行开始的editpost函数中, 就可以在编辑帖子之后也更新了吧.

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 16:05

Powered by Discuz!

× 快速回复 返回顶部 返回列表