本帖最后由 otherbank 于 2011-10-8 10:38 编辑
- [hide=1000]加密的帖子内容[/hide]
复制代码
Discuz! X2,发帖时使用了这样的添加隐藏内容后,连发帖者本人都看不到内容了,除非你的积分高于你的设定,除非你是管理员才能看到。
如何实现加密帖本人可以看见帖子内容呢?
有的DZ网友曾经试着这样改过source\function\function_discuzcode.php文件的36行:
if($_G['member']['credits'] >= $creditsrequire || $_G['forum']['ismoderator'] || ($_G['thread']['authorid'] == $_G['uid']))
这样改过之后,在自己发的主题帖里加密,或者在自己主题帖里回复加密,都是可以看见的;
但在别人发的主题帖里,用加密帖回复后,你自己就看不到了。
怎么完美解决这个问题呢,加密贴在阅读权限高的可看、管理员可看基础上,实现发帖本人既能看自己的加密贴主题,还能看自己的加密贴回复呢?
这个问题的解决方法两步:
一、修改文件"\source\module\forum\forum_viewthread.php"找到大约893行:
- if($post['username']) {
- $_G['forum_onlineauthors'][] = $post['authorid'];
- $post['usernameenc'] = rawurlencode($post['username']);
- $post['readaccess'] = $_G['cache']['usergroups'][$post['groupid']]['readaccess'];
- if($_G['cache']['usergroups'][$post['groupid']]['userstatusby'] == 1) {
- $post['authortitle'] = $_G['cache']['usergroups'][$post['groupid']]['grouptitle'];
- $post['stars'] = $_G['cache']['usergroups'][$post['groupid']]['stars'];
- }
复制代码 修改为:
- if($post['username']) {
- $_G['authorid'] = $post['authorid'];
- $_G['forum_onlineauthors'][] = $post['authorid'];
- $post['usernameenc'] = rawurlencode($post['username']);
- $post['readaccess'] = $_G['cache']['usergroups'][$post['groupid']]['readaccess'];
- if($_G['cache']['usergroups'][$post['groupid']]['userstatusby'] == 1) {
- $post['authortitle'] = $_G['cache']['usergroups'][$post['groupid']]['grouptitle'];
- $post['stars'] = $_G['cache']['usergroups'][$post['groupid']]['stars'];
- }
复制代码
二、修改文件"\source\function\function_discuzcode.php"的函数creditshide大约在36行
- function creditshide($creditsrequire, $message, $pid) {
- global $_G;
- if($_G['member']['credits'] >= $creditsrequire || $_G['forum']['ismoderator'] )
- {
- return tpl_hide_credits($creditsrequire, str_replace('\"', '"', $message));
- } else {
- return tpl_hide_credits_hidden($creditsrequire);
- }
- }
复制代码 修改为:
- function creditshide($creditsrequire, $message, $pid) {
- global $_G;
- if($_G['member']['credits'] >= $creditsrequire || $_G['forum']['ismoderator'] || ($_G['authorid'] == $_G['uid']))
- {
- return tpl_hide_credits($creditsrequire, str_replace('\"', '"', $message));
- } else {
- return tpl_hide_credits_hidden($creditsrequire);
- }
- }
复制代码
OK!
|