discuz!X1.5 指定版块发帖时 自动默认最高阅读权限(让您的秘密版块只有vip可见)

Posted by admin on 2011, July 29

有时候站里一些特殊版块 ,比如我那个站,里面有几个版块需要发帖的时候,想让只有vip才能看到,或者只有楼主和管理员可见,而其他人只能看到列表而看不到内容,这就用到一下代码了

修改文件:/template/default/forum/post.htm

记事本打开这个文件 找到

<!--{if $_G['group']['allowsetreadperm']}-->  

<p class="mbn">{lang readperm}:</p>  

<p class="mbn">  

<em class="ftid">  

<select name="readperm" id="readperm" class="ps" style="width:90px">  

<option value="">{lang unlimited}</option>  

<!--{loop $_G['cache']['groupreadaccess'] $val}-->  

<option value="$val[readaccess]" title="{lang readperm}: $val[readaccess]"{if $thread['readperm'] == $val[readaccess]} selected="selected"{/if}>$val[grouptitle]</option>  
<!--{/loop}-->  
<option value="255">{lang highest_right}</option>  
</select>  
</em>  
<img src="{IMGDIR}/faq.gif" alt="Tip" class="mtn vm" style="margin: 0;" onmouseover="showTip(this)" tip="{lang post_select_usergroup_readacces}" /></a>  
</p>  
<!--{/if}-->

改成

<!--{if $_G['fid'] == 39 }-->  
<p class="mbn">{lang readperm}:</p>  
<p class="mbn">  
<em class="ftid">  
<select name="readperm" id="readperm" class="ps" style="width:90px">  
<option value="255">{lang highest_right}</option>  
</select>  
</em>  
<img src="{IMGDIR}/faq.gif" alt="Tip" class="mtn vm" style="margin: 0;" onmouseover="showTip(this)" tip="{lang post_select_usergroup_readacces}" /></a>  
</p>  
<!--{elseif $_G['group']['allowsetreadperm']}-->  
<p class="mbn">{lang readperm}:</p>  
<p class="mbn">  
<em class="ftid">  
<select name="readperm" id="readperm" class="ps" style="width:90px">  
<option value="">{lang unlimited}</option>  
<!--{loop $_G['cache']['groupreadaccess'] $val}-->  
<option value="$val[readaccess]" title="{lang readperm}: $val[readaccess]"{if $thread['readperm'] == $val[readaccess]} selected="selected"{/if}>$val[grouptitle]</option>  
<!--{/loop}-->  
<option value="255">{lang highest_right}</option>  
</select>  
</em>  
<img src="{IMGDIR}/faq.gif" alt="Tip" class="mtn vm" style="margin: 0;" onmouseover="showTip(this)" tip="{lang post_select_usergroup_readacces}" /></a>  
</p>  
<!--{/if}-->

即可,PS:替换后的第一行代码中39需要更换为目标版块的fid怎么知道fid号?当前版块的地址中比如:http://www.discuz.net/forumdisplay.php?fid=2组后fid=后的那个数字 就是当前版块fid号这样就行了,其中value对应的就是阅读权限,比如255,而{lang highest_right}代表了最高权限四个字,其他大家自己参悟喽