Elgg - perform an action for a guest user
I need to perform an action like save the result for a survey开发者_JAVA技巧 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
check the register_action , there is a parameter $public
with options true/false
if u set it to true
this action be accessed by people not logged into the system.
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 )
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
精彩评论