DedeCMS 仅限会员发表评论的修改方法

困难是动摇者和懦夫掉队回头的便桥;但也是勇敢者前进的脚踏石。我不识何谓君子,但看每事肯吃亏者便是;我不识何谓小人,但看每事好占便宜者便是。
只有会员才可以发表评论。 实现原理:判断是否登录,是,则加载评论框和按钮等,否,则提示只有注册或登录后才可以发表评论。
下面列出需要修改的文件的代码:
1、文章页模板article_article.htm (以下代码插入你模板的合适位置):
Copy to ClipboardLiehuo.Net Codes引用的内容:[www.dede58.com]
<div class="box">
<h2><a name="comment">评论内容</a></h2>
<p> </p>
<div class="content">
<form action="{dede:field name='phpurl'/}/feedback.php" method="post" name="feedback">
<input type="hidden" name="action" value="send" />
<input type="hidden" name="comtype" value="comments">
<input type="hidden" name="aid" value="{dede:field name="id"/}" />
<input type="hidden" name="isconfirm" value="yes" />
<p>
<script language='javascript' type='text/javascript' src="{dede:field name='phpurl'/}/feedback_js.php?aid={dede:field name='id'/}"></script>
<br></p>
<p><label for="txaArticle"></label></p>
<div class="dcmp-userinfo" id="_ajax_feedback">
请您<b><a target="_blank" rel="nofollow noopener noreferrer" href="{dede:global.cfg_memberurl/}/index_do.php?fmdo=user&dopost=regnew"><font size="4" color="#008000">注册</font></a></b>或者<b><a target="_blank" rel="nofollow noopener noreferrer" href="{dede:global.cfg_memberurl/}/login.php"><font size="4" color="#008000">登录</font></a></b>后发表评论! 忘记密码了?点击<b><a target="_blank" rel="nofollow noopener noreferrer" href="{dede:global.cfg_memberurl/}/resetpassword.php"><font color="#008000" size="4">这里</font></a></b>找回密码!
</div>
<script language="javascript" type="text/javascript">CheckLogin();</script>
</p><br>
</form>
</div></div>
2、member目录下的ajax_feedback.php (全部内容):
Copy to ClipboardLiehuo.Net Codes引用的内容:[www.veryhuo.com]
<?php
require_once(dirname(__FILE__)."/config.php");
AjaxHead();
if($myurl == '')
{
exit('');
}
$uid = $cfg_ml->M_LoginID;
$face = $cfg_ml->fields['face'] == '' ? $GLOBALS['cfg_memberurl'].'/images/nopic.gif' : $cfg_ml->fields['face'];
?>
<p>
<div class="dcmp-mood">
<strong>评价:</strong>
<ul>
<li><input type="radio" name="feedbacktype" checked="1" value="feedback" id="dcmp-stand-neu" /><label for="dcmp-stand-neu"><img src="/templets/images/cmt-neu.gif" />中立</label>
<li><input type="radio" name="feedbacktype" value="good" id="dcmp-stand-good" /><label for="dcmp-stand-good"><img src="/templets/images/cmt-good.gif" />好评</label>
<li><input type="radio" name="feedbacktype" value="bad" id="dcmp-stand-bad" /><label for="dcmp-stand-bad"><img src="/templets/images/cmt-bad.gif" />差评</label>
</ul>
</div>
</p>
<div class="dcmp-mood">
<strong>表情:</strong>
<ul>
<li><input type="radio" name='face' value='6' checked="1" /><img src="/templets/images/mood/ico-mood-6.gif" /></li>
<li><input type="radio" name='face' value='4'/><img src="/templets/images/mood/ico-mood-4.gif" /></li>
<li><input type="radio" name='face' value='3'/><img src="/templets/images/mood/ico-mood-3.gif" /></li>
<li><input type="radio" name='face' value='5'/><img src="/templets/images/mood/ico-mood-5.gif" /></li>
<li><input type="radio" name='face' value='2'/><img src="/templets/images/mood/ico-mood-2.gif" /></li>
<li><input type="radio" name='face' value='1'/><img src="/templets/images/mood/ico-mood-1.gif" /></li>
<li><input type="radio" name='face' value='7'/><img src="/templets/images/mood/ico-mood-7.gif" /></li>
</ul>
</div>
<p><textarea cols="60" name="msg" rows="5" class="ipt-txt" style="width:600px; height:100px;" ></textarea></p>
以用户名 <?php echo $cfg_ml->M_UserName; ?> 发表评论,请控制在200字以内。系统会自动记录你的IP地址,请勿发布非法信息!
<p>验证码:<input name="validate" type="text" id="validate" size="10" style="height:15px;width:50px;margin-right:6px;" class="nb" />
<img src='<?php echo $cfg_cmsurl;?>/include/vdimgck.php' width='50' height='20' />
<input type="submit" id="submit" value="提交评论" class="button" />
<?php if($cfg_feedback_ck=='Y') { ?>
</p>
<?php } ?>
3、templets目录下plus里的feedback_templet_js.htm (全部内容):
Copy to ClipboardLiehuo.Net Codes引用的内容:[www.dede58.com]
{dede:config pagesize='5'/}
{dede:datalist}
<?php
if($fields['userid']!='') $spaceurl = $cfg_basehost.'/member/index.php?uid='.$fields['userid'];
else $spaceurl = "#";
if($fields['username']=='匿名') $spaceurl = "#";
$fields['bgimg'] = 'cmt-neu.gif';
$fields['ftypetitle'] = '该用户表示中立';
if($fields['ftype']=='bad') {
$fields['bgimg'] = 'cmt-bad.gif';
$fields['ftypetitle'] = '该用户表示差评';
}
else if($fields['ftype']=='good') {
$fields['bgimg'] = 'cmt-good.gif';
$fields['ftypetitle'] = '该用户表示好评';
}
?>
document.write("<div class='decmt-box'>");
document.write("<div class='decmt-title'>");
document.write("<span class='moodico'><img src='{dede:global.cfg_templeturl/}/images/mood/ico-mood-<?php if($fields['face']>0) echo $fields['face'];?>.gif'/></span>");
document.write("<span class='username'><a rel="nofollow noopener noreferrer" href='<?php echo $spaceurl;?>'>{dede:field.username/}</a></span>");
document.write("<span class='date'>{dede:field.dtime function=GetDateMk(@me)/}</span>");
document.write("<span>评论<img src='{dede:global.cfg_templeturl/}/images/{dede:field.bgimg/}' alt='{dede:field.ftypetitle/}' /></span>");
document.write("</div>");
document.write("<div class='decmt-act'>");
document.write("</div>");
document.write("<div class='decmt-content'>{dede:field.msg function='jstrim(@me,500)'/}");
document.write(" ");
document.write("<span id='goodfb{dede:field.id/}'><a rel="nofollow noopener noreferrer" href=#goodfb{dede:field.id/} onclick=postBadGood('goodfb',{dede:field.id/})>支持</a>[{dede:field.good/}]</span>");
document.write("<span id='badfb{dede:field.id/}'><a rel="nofollow noopener noreferrer" href=#badfb{dede:field.id/} onclick=postBadGood('badfb',{dede:field.id/})>反对</a>[{dede:field.bad/}]</span>");
document.write("</div>");
document.write("</div>");
{/dede:datalist}

以上就是DedeCMS 仅限会员发表评论的修改方法。要记住每一个对你好的人,因为他们本可以不这么做的。更多关于DedeCMS 仅限会员发表评论的修改方法请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
dedecms如何实现任意页面调用当前会员信息的方

DedeCMS织梦判断是否有二级栏目输出HTML代码

织梦dedecms dede:arclist输出取消换行符

dedecms文章添加字段填栏目id,内容页调用字段里的栏目文章

dedeCMS首页列表页文章页调用tag的方法