mt 发表于 2020-12-21 11:11:12

discuz 文章游客可以表态的实现

1、找到文件:source/module/home/home_spacecp.php,注释或删除
if(empty($_G['uid'])) { if($_SERVER['REQUEST_METHOD'] == 'GET') { dsetcookie('_refer', rawurlencode($_SERVER['REQUEST_URI'])); } else { dsetcookie('_refer', rawurlencode('home.php?mod=spacecp&ac='.$ac)); } showmessage('to_login', '', array(), array('showmsg' => true, 'login' => 1)); } 找到:
if(empty($space)) { showmessage('space_does_not_exist'); } 注释或删除。2、找到文件:/source/include/spacecp/spacecp_click.php
if(!checkperm('allowclick') || $_GET['hash'] != $hash) { showmessage('no_privilege_click'); } 注释或删除。
if(C::t('home_clickuser')->count_by_uid_id_idtype($space, $id, $idtype)) { showmessage('click_have'); } 注释或删除。
3、在/source/include/spacecp/spacecp_click.php添加开启session机制。
在头部添加:
session_start();在刚才删除或注释的:
/*if(C::t('home_clickuser')->count_by_uid_id_idtype($space['uid'], $id, $idtype)) {      showmessage('click_have');      }*/ 下面添加:
if($_SESSION['vote'] == session_id()){      showmessage('click_have');      }      $_SESSION['vote'] = session_id(); 更新缓存即可。

mt 发表于 2020-12-21 11:12:18

已知问题:可以实现游客表态的功能,但是如果同一台电脑,游客表态后,同一篇文章会员登录不能表态,期待解决。
页: [1]
查看完整版本: discuz 文章游客可以表态的实现