- I have 2 webforms: survey webform and task webform.
- The entry point is task webform and it requires user to login.
- There is a controller or something to check if user has previously filled in a survey webform, if he/she did, go straight to task webform. Otherwise, need to go to survey form.
- I know how to create webforms, but not sure how to make such controller.
1 Answer
I am not sure about your control here, whether to move from survey webform to task webform or the vice versa. But this is what I would do.,
On login query the "webform_submissions" table with the logged in user's id and see whether he/she has submitted the webform before.
If he/she has not submitted it before load the webform say task webform.
If he has submitted this before, load the survey webform page.
You can make use of "hook_user_login" to redirect on login, also this can be used to query the "webform_submissions" table.
-
hook_url_inbound_alter works for me. It allows me to match the url, then check whether a user fills a survey or not.– kenpeterCommented May 14, 2013 at 23:32