dedecms实现游客可以提问、回答及查看的方法
dedecms中有些情况下我们需要给予游客一定的权限,如提问、回答及查看等,本文就此给出如下解决方法:
1、游客提问:
找到dedecms5.7的/ask/control目录下的question.php文件,找到其中的这样一段代码并删除:
if(empty($this->cfg_ml->M_ID))
{
ShowMsg('您尚未登录,请先登录',$GLOBALS['cfg_ask_member']);
exit;
}
if($this->cfg_ml->M_Spacesta < 0)
{
ShowMsg('您还没有通过审核,暂时不能提问,请耐心等....','-1');
exit;
}
{
ShowMsg('您尚未登录,请先登录',$GLOBALS['cfg_ask_member']);
exit;
}
if($this->cfg_ml->M_Spacesta < 0)
{
ShowMsg('您还没有通过审核,暂时不能提问,请耐心等....','-1');
exit;
}
2、游客问答,提示“请勿重复回复同一问题”:
同样找到找到并删除dedecms5.7的/ask/control目录下的question.php文件,找到其中的这样一段代码:
if($rs)
{
ShowMsg('请勿重复回复同一问题!','-1');
exit;
}
{
ShowMsg('请勿重复回复同一问题!','-1');
exit;
}
3、问题已过期、提问者自己不能回答自己的问题
同样找到找到并删除dedecms5.7的/ask/control目录下的question.php文件,找到其中的这样一段代码
if($question)
{
if($question['uid'] == $this->cfg_ml->M_ID)
{
ShowMsg('提问者自己不能回答自己的问题', '-1');
exit;
}else if($question['expiredtime'] < $GLOBALS['cfg_ask_timestamp']){
ShowMsg('问题已经过期','-1');
exit;
}
$data['tid'] = $question['tid'];
$data['tid2'] = $question['tid2'];
$data['userip'] = getip();
}else{
ShowMsg('回答的问题不存在','-1');
exit;
}
{
if($question['uid'] == $this->cfg_ml->M_ID)
{
ShowMsg('提问者自己不能回答自己的问题', '-1');
exit;
}else if($question['expiredtime'] < $GLOBALS['cfg_ask_timestamp']){
ShowMsg('问题已经过期','-1');
exit;
}
$data['tid'] = $question['tid'];
$data['tid2'] = $question['tid2'];
$data['userip'] = getip();
}else{
ShowMsg('回答的问题不存在','-1');
exit;
}
4、“您尚未登录,请先登录”
找到找到并删除dedecms5.7的/ask/control目录下的myask.php文件
if(empty($this->cfg_ml->M_ID))
{
ShowMsg('您尚未登录,请先登录',$GLOBALS['cfg_ask_member']);
exit;
}
{
ShowMsg('您尚未登录,请先登录',$GLOBALS['cfg_ask_member']);
exit;
}
找到找到并删除dedecms5.7的/ask/control目录下的search.php文件
if(empty($cfg_ml->M_ID))
{
ShowMsg('您尚未登录,请先登录',$GLOBALS['cfg_ask_member']);
exit;
}
if($cfg_ml->M_Spacesta = 0)
{
ShowMsg('您还没有通过审核,暂时不能提问,请耐心等....','-1');
exit;
}
{
ShowMsg('您尚未登录,请先登录',$GLOBALS['cfg_ask_member']);
exit;
}
if($cfg_ml->M_Spacesta = 0)
{
ShowMsg('您还没有通过审核,暂时不能提问,请耐心等....','-1');
exit;
}
5、“验证码错误!”“验证问题答案错误”
找到找到并删除dedecms5.7的/ask/control目录下的question.php文件
if(preg_match("#7#",$GLOBALS['safe_gdopen'])){
$svali = GetCkVdValue();
if(strtolower($data['vdcode']) != $svali || $svali=='')
{
ResetVdValue();
ShowMsg('验证码错误!', '-1');
exit();
}
}
//检查验证问题
$faqkey = isset($data['faqkey']) && is_numeric($data['faqkey']) ? $data['faqkey'] : 0;
if($GLOBALS['gdfaq_ask'] == 'Y')
{
global $safefaqs;
if($safefaqs[$faqkey]['answer'] != $data['safeanswer'] || $data['safeanswer'] =='')
{
ShowMsg('验证问题答案错误', '-1');
exit();
}
}
$svali = GetCkVdValue();
if(strtolower($data['vdcode']) != $svali || $svali=='')
{
ResetVdValue();
ShowMsg('验证码错误!', '-1');
exit();
}
}
//检查验证问题
$faqkey = isset($data['faqkey']) && is_numeric($data['faqkey']) ? $data['faqkey'] : 0;
if($GLOBALS['gdfaq_ask'] == 'Y')
{
global $safefaqs;
if($safefaqs[$faqkey]['answer'] != $data['safeanswer'] || $data['safeanswer'] =='')
{
ShowMsg('验证问题答案错误', '-1');
exit();
}
}
本文由主机测评网发布,不代表主机测评网立场,转载联系作者并注明出处:https://zhuji.jb51.net/dedecms/3678.html