当前位置:找DLL下载站系统新闻软件疑难软件问题 → Discuz后台全局置顶和分类置顶(分区置顶)功能开关分开

Discuz后台全局置顶和分类置顶(分区置顶)功能开关分开

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2019/2/3 19:58:11

1、        数据库中  forum_forum表数据结构
Allowglobalstick 字段后增加allowforumstick字段
类型tinyint 默认为1


2、   后台界面及处理文件source\admincp\admincp_forums.php
840行
showsetting('forums_edit_extend_recommend_top', 'allowglobalsticknew', $forum['allowglobalstick'], 'radio');
下添加
showsetting('forums_edit_extend_forumrecommend_top', 'allowforumsticknew', $forum['allowforumstick'], 'radio');
1470行
$allowglobalsticknew = $_GET['allowglobalsticknew'] ? 1 : 0;
下添加
$allowforumsticknew = $_GET['allowforumsticknew'] ? 1 : 0;
1502行
'allowglobalstick' => $allowglobalsticknew,
下添加
'allowforumstick' => $allowforumsticknew,


3、source/language/lang_admincp.php语言包文件
2476行更改为
//'forums_edit_extend_recommend_top' => '显示全局置顶和分类置顶的主题',
//'forums_edit_extend_recommend_top_comment' => '是否在本版显示全局置顶和分版置顶',
'forums_edit_extend_recommend_top' => '显示全局置顶的主题',
'forums_edit_extend_recommend_top_comment' => '是否在本版显示全局置顶的主题',
'forums_edit_extend_forumrecommend_top' => '显示分类置顶的主题',
  'forums_edit_extend_forumrecommend_top_comment' => '是否在本版显示分类置顶的主题',
4、
1、        前台显示判断页面source\module\forum\forum_forumdisplay.php
507行
/* if($_G['setting']['globalstick'] && $_G['forum']['allowglobalstick']) {
$stickytids = explode(',', str_replace("'", '', $_G['cache']['globalstick']['global']['tids']));
if(!empty($_G['cache']['globalstick']['categories'][$thisgid]['count'])) {
        $stickytids = array_merge($stickytids, explode(',', str_replace("'", '', $_G['cache']['globalstick']['categories'][$thisgid]['tids'])));
}

if($_G['forum']['status'] != 3) {
        $stickycount = $_G['cache']['globalstick']['global']['count'];
        if(!empty($_G['cache']['globalstick']['categories'][$thisgid])) {
               $stickycount += $_G['cache']['globalstick']['categories'][$thisgid]['count'];
        }
}
} */

隐藏,用下面代码替换

if($_G['setting']['globalstick'] && $_G['forum']['allowglobalstick'] &&$_G['forum']['allowforumstick']) {
$stickytids = explode(',', str_replace("'", '', $_G['cache']['globalstick']['global']['tids']));
if(!empty($_G['cache']['globalstick']['categories'][$thisgid]['count'])) {
        $stickytids = array_merge($stickytids, explode(',', str_replace("'", '', $_G['cache']['globalstick']['categories'][$thisgid]['tids'])));
}

if($_G['forum']['status'] != 3) {
        $stickycount = $_G['cache']['globalstick']['global']['count'];
        if(!empty($_G['cache']['globalstick']['categories'][$thisgid])) {
               $stickycount += $_G['cache']['globalstick']['categories'][$thisgid]['count'];
        }
}
}
elseif($_G['setting']['globalstick'] && $_G['forum']['allowglobalstick'])
{//var_export($_G['cache']['globalstick']['categories'][$thisgid]['count']);
$stickytids = explode(',', str_replace("'", '', $_G['cache']['globalstick']['global']['tids']));

if($_G['forum']['status'] != 3) {
        $stickycount = $_G['cache']['globalstick']['global']['count'];
        if(!empty($_G['cache']['globalstick']['categories'][$thisgid])) {
               $stickycount += $_G['cache']['globalstick']['categories'][$thisgid]['count'];
        }
}
}elseif($_G['setting']['globalstick'] && $_G['forum']['allowforumstick'])
{
$stickytids = explode(',', str_replace("'", '', $_G['cache']['globalstick']['categories'][$thisgid]['tids']));
//var_export($stickytids);

if($_G['forum']['status'] != 3) {
        $stickycount = $_G['cache']['globalstick']['global']['count'];
        if(!empty($_G['cache']['globalstick']['categories'][$thisgid])) {
               $stickycount += $_G['cache']['globalstick']['categories'][$thisgid]['count'];
        }
}
}

修改后的效果