0
votes

I want to force anonymous to register an account before submitting the form. So I have to allow permission for anonymous to access the form, Then I use hook_form_FORM_ID_alter to edit form. Then I wanted to redirect submit button to another link if it is clicked by anonymous.(I still have no idea how to do it. It would be nice if anyone can tell me) Is this the right solution?

For now, I have a pop-up a login form (Modal forms and Facebook OAuth). In the form there is a register button. Then If user choose to register I want to keep the form that he have already input and show it after he confirm his email.

Thank you.

1

1 Answers

1
votes

Off the top of my head, I would allow the form to be submitted either by an anonymous user or a registered one.

in my function MYMODULE_MYFORM_submit() I would check to see if the user is logged in.

If yes proceed as normal, if no, store the form, either in a temp SESSION variable or into a custom MySQL table and forward the user to login/register page (mysite.com/user) using drupal_goto('user')

once the user was registered you could then check for the existence of the form in the SESSION array or your MySQL table, and then carry on with the process as you would if the user had been logged in in the first place

Hope this makes sense or is of help