Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[5.5.0]只看楼主(只显示楼主)/阅读全部 切换(适合连载论坛)

[复制链接]
Arice 发表于 2007-3-20 01:23:44 | 显示全部楼层 |阅读模式
旧版本:
浏览主题只显示楼主的帖子 For Discuz! 5.0 Or 4.1

演示地址: http://nt.discuz.net/showtopic.aspx?topicid=7766&onlyauthor=1

5.5.0版本,请根据下面的步骤操作
一.备份需要修改的三个文件

viewthread.php,
templates/default/viewthread.htm,
templates/default/template.lang.php

二.修改文件

1.打开 viewthread.php
1.1查找
  1. $thread['subjectenc'] = rawurlencode($thread['subject']);
复制代码

在下面添加
  1. $authorid = $thread['authorid'];
复制代码

1.2查找
  1. $postlist = $attachtags = $attachlist = array();
复制代码

在下面添加
  1. $extrasql = !empty($originator) ? "AND p.authorid='$authorid'" : '';
复制代码

1.3查找并删除
  1. $multipage = multi($thread['replies'] + 1, $ppp, $page, "viewthread.php?tid=$tid&extra=$extra".(isset($highlight) ? "&highlight=".rawurlencode($highlight) : ''));
复制代码

1.4查找
  1. WHERE p.tid='$tid' AND p.invisible='0' ORDER BY dateline LIMIT $start_limit, $ppp");
复制代码

替换成
  1. WHERE p.tid='$tid' $extrasql AND p.invisible='0' ORDER BY dateline LIMIT $start_limit, $ppp");
  2.                 if(!empty($originator)) {
  3.                         $query_count = $db->query("SELECT COUNT(*) FROM {$tablepre}posts WHERE tid='$tid' AND authorid='$authorid'");
  4.                         $thread['posts'] = $db->result($query_count,0);
  5.                         $multipage = multi($thread['posts'], $ppp, $page, "viewthread.php?tid=$tid&extra=$extra&originator=yes".(isset($highlight) ? "&highlight=".rawurlencode($highlight) : ''));        
  6.                 } else {
  7.                         $multipage = multi($thread['replies'] + 1, $ppp, $page, "viewthread.php?tid=$tid&extra=$extra".(isset($highlight) ? "&highlight=".rawurlencode($highlight) : ''));
  8.                 }
复制代码


2.打开/templates/default/viewthread.htm
查找
  1. <!--{if $magicstatus}-->
  2.         <div class="right" style="padding-top: {TABLESPACE}px;"><a href="magic.php?action=user&pid=$post[pid]" target="_blank">{lang magics_use}</a>  </div>
  3.         <!--{/if}-->
复制代码

替换为
  1. <div class="right" style="padding-top: {TABLESPACE}px;">
  2.         <!--{if $post['authorid'] == $authorid}-->
  3.         <!--{if !$originator}-->
  4.         <a href="viewthread.php?tid=$thread[tid]&extra=$extra&originator=yes">{lang onlyreadauthor}</a>&nbsp;
  5.         <!--{else}-->
  6.         <a href="viewthread.php?tid=$thread[tid]&extra=$extra">{lang readallposter}</a>&nbsp;
  7.         <!--{/if}-->
  8.         <!--{/if}-->
  9.         <!--{if $magicstatus}-->
  10.         <a href="magic.php?action=user&pid=$post[pid]" target="_blank">{lang magics_use}</a>&nbsp;&nbsp;
  11.         <!--{/if}-->
  12.         </div>
复制代码


3.打开 templates/default/template.lang.php
查找
  1. 'leftmenu_index' => '论坛首页',
复制代码

在下面加入
  1.         'onlyreadauthor' => '只看楼主',
  2.         'readallposter' => '阅读全部',
复制代码


三.登录管理员到后台更新缓存

[ 本帖最后由 Arice 于 2007-3-25 02:11 编辑 ]

评分

4

查看全部评分

 楼主| Arice 发表于 2007-3-20 01:23:51 | 显示全部楼层
更新记录:
1.将懒人替换包中的文件更新至最新版.
2.修正翻页 rewrite 规则无效.(无效的原因是因为 Discuz! 编辑器中,我在发这个 hack 帖之后,重新编辑帖子会将我帖子中的 &a mp; 替换成  &)


需要对特定版块开启这种功能,请看 https://discuz.dismall.com/viewth ... p;page=2#pid4591244


懒人替换包

适用范围:
没有对涉及到的三个文件 viewthread.php, templates/default/viewthread.htm, templates/default/template.lang.php 做过任何修改

只需要替换已经修改好的三个文件,登录后台更新缓存即可生效.



如果修改错误了,可以换回原版.



[ 本帖最后由 Arice 于 2007-3-25 02:23 编辑 ]

评分

1

查看全部评分

回复

使用道具 举报

 楼主| Arice 发表于 2007-3-20 01:23:58 | 显示全部楼层
更新历史:

2007年3月20日上午10点16分更新
          修正显示问题

[ 本帖最后由 Arice 于 2007-3-20 10:21 编辑 ]
回复

使用道具 举报

998w 发表于 2007-3-20 01:35:59 | 显示全部楼层
回复

使用道具 举报

998w 发表于 2007-3-20 01:36:21 | 显示全部楼层
回复

使用道具 举报

998w 发表于 2007-3-20 01:36:41 | 显示全部楼层
回复

使用道具 举报

 楼主| Arice 发表于 2007-3-20 01:49:49 | 显示全部楼层
楼上灌纯净水.
鉴定完毕
回复

使用道具 举报

lu5266 发表于 2007-3-20 09:17:35 | 显示全部楼层
严重同意~~
回复

使用道具 举报

單身好浪漫 发表于 2007-3-20 09:23:31 | 显示全部楼层
支持.....嘿嘿
回复

使用道具 举报

hkin 发表于 2007-3-20 09:43:54 | 显示全部楼层
跟使用道具不在同一行上阿
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-8 10:43 , Processed in 0.111687 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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