Archive

Archive for October, 2014

discuz diy 模块推荐主题过滤Bug

October 21st, 2014

不小心接了个论坛的活,采用discuz 来搭建,遇到个Bug

开启门户4合1模块后报错:
1054) Unknown column ‘tr.tid’ in ‘on clause’
SELECT a.*, t.tid, t.subject, t.authorid, t.author FROM forum_activity a INNER JOIN `forum_thread` t ON t.tid=a.tid AND t.isgroup=’0′ AND t.displayorder>=’0′ INNER JOIN `forum_forumrecommend` fc ON fc.tid=tr.tid ORDER BY t.dateline DESC LIMIT 0,5;
PHP Debug
第一次访问(或者删除缓存后)出现,之后会正常显示,但是模块“根据推荐主题过滤”选项不起作用。不知道discuz 是怎么处理在报错的情况下还能正常生成缓存的,很厉害。

模块有个推荐主题过滤选项,是否只显示推荐主题。

source/class/block/forum/block_activity.php
line:277
if($recommend) {
$sqlfrom .= ” $joinmethod JOIN `”.DB::table(‘forum_forumrecommend’).”` fc ON fc.tid=tr.tid”;
}
意思应该是活动表和推荐表关联,但是关联表tr 错误,参考
line:281
$query = DB::query(“SELECT a.*, t.tid, t.subject, t.authorid, t.author$sqlfield
FROM “.DB::table(‘forum_activity’).” a $sqlfrom $where
ORDER BY $orderby
LIMIT $startrow,$items;”
);
应该改为:
if($recommend) {
$sqlfrom .= ” $joinmethod JOIN `”.DB::table(‘forum_forumrecommend’).”` fc ON fc.tid=a.tid”;
}
群组活动也有同样的问题:
source/class/block/group/block_groupactivity.php
line:292
if($recommend) {
$sqlfrom .= ” $joinmethod JOIN `”.DB::table(‘forum_forumrecommend’).”` fc ON fc.tid=tr.tid”;
}
改为:
if($recommend) {
$sqlfrom .= ” $joinmethod JOIN `”.DB::table(‘forum_forumrecommend’).”` fc ON fc.tid=a.tid”;
}

绝口不提技术 , ,