3

How is it possible to have CCK form on the front page for instance and once the user clicks on "Save", check if the user is already signed in and if not, redirect to the creation of an account, but by keeping the data entered in the CCK form to avoid them to reenter every field ?

I've checked on the net but nothing seems to do this so far...

Thanks for any help :-)

2

One option would be to do this in a custom module with hook_form_alter(). You could use it to alter the CCK form to add a custom validation/submit handler that redirects anonymous users to the registration page. The inserted form data could be stored in the session (before redirecting) from where you can retrieve it later to fill in the form with default values (using hook_form_alter() again). I'm assuming that you do not need to store the data for long periods of time since session is not suitable for that. You should also unset the used session variables after use.

1
  • 1
    +1, that's correct, storing it in $_SESSION is a possible solution (storing data temporarily in database may be an overkill because of the unnecessarily high resource usage). By the way, I think redirections AFTER filling out and submitting a complete form can be REALLY irritating for the user. Maybe a redirection would be reasonable BEFORE the user fills out the whole form. – Sk8erPeter Apr 10 '12 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.