您现在的位置: 万盛学电脑网 >> 程序编程 >> CMS教程 >> 正文

[二次开发]dede5.7 问答限制仅能管理员回答问题

作者:佚名    责任编辑:admin    更新时间:2022-06-22

class="area">

本修改不涉及用户权限修改,仅仅是加入了简单的判定,

如果是管理员且登陆则显示回答问题的部分,否则则不显示。

代码修改如下:

<?php if($cfg_ml->isAdmin == 1) { ?>

<div class="bor1 mt10 pd10 reply">
<form method="post" name="answer" action="?ct=question&ac=answer&askaid=<?php echo $question['id']; ?>">
<h3><span class="fl">我来回答这个问题</span></h3>
<div class="mt10 reply_edit"><?php GetFck("content","",400);?></div>
<div class="reply_edit_btn"><span class="fl mt10">回答即可得<?php echo $cfg_ask_answerscore;?>分,回答被采纳则获得悬赏分以及奖励<?php echo $cfg_ask_bestanswer;?>分。</span><span class="fl ml10 mt10"><label>
<?php
if($GLOBALS['cfg_ask_guestanswer'] == 'Y')
{
?>
<input name="anonymous" type="checkbox" value="1"/>匿名回答</label><?php
}
?></span><button type="submit" class="btn fr">提交回答</button></div>
</form>
</div>

<?php } ?>


灰色部分就是回答问题代码。 红色则是判定。