Elgg - 为来宾用户执行操作
我需要执行一项操作,例如保存 elgg 中访客用户(未注册/未登录)的调查结果,其中用户仅获得具有 data 形式的页面。 我设法得到这个东西,但是当我提交操作时它显示错误
抱歉,您无法在注销时执行此操作。
并重定向到登录页面。
如何解决这个问题 谢谢
I need to perform an action like save the result for a survey for a guest user(non registered/not logged in) in elgg, in which the user only gets a page having a form of data .
I manage to get this thing but, when i submit the action it shows the error
Sorry, you cannot perform this action while logged out.
and redirect to the login page.
How to solve this issue
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
检查 register_action ,有一个带有选项的参数
$public
true/false
如果您将其设置为
true
此操作为未登录系统的人员可以访问。check the register_action , there is a parameter
$public
with optionstrue/false
if u set it to
true
this action be accessed by people not logged into the system.问题是,调用的每个操作都会由 elgg 使用 action-_gatekeeper() 方法进行检查。
解决这个问题的最简单方法是不要将调查结果发送到定义为操作的脚本,而是将表单直接提交到脚本(提交 URL 类似于 www.your site.com/mod /yourPlugin/handleSurvey.php )
The problem is that each action that is called gets checked by elgg with the action-_gatekeeper() method.
The easiest way to get around this is to not have your survey results sent to a script defined as an action, but rather just have your form submit directly to your script (have the submit URL be something like www.your site.com/mod/yourPlugin/handleSurvey.php )
是的,确实如此,您可以将操作设置为 public,但之后为了将结果保存在 elgg 中,您必须覆盖访问权限,以便未登录的用户可以将数据保存到数据库中。
检查权限检查
Yes that's true, you can set action public, but after that for saving results in elgg, you have to override the accesses so that not loggedin user can save data to database.
Check for the Permissions Check