Adding message after member registration
I am currently using the registration module to let visitors register themselves on the website. I only would like to show a message after the details has been submitted. At the moment when you click submit it will return back to the registration form but it won't show some confirmation message. I would like to add a message saying that the registration is successful and that you should you have received an activation e-mail.
My question now is how can I easily do this? I have been checking out the registration module but doesn't seem to be supported. My German book (Das offiziele Contao-Buch) about Contao talks about hooks. The only alternative is to make redirect to a new page via Redirect page / Confirmation page.
If I understood it correctly I should be able to use the "createNewUser"-hook in a custom module which adds a message to the current session. And then I will make a custom template for the registration form which will read this out and unset the message session variable after it has been shown. Would this be a good approach? I have tried this only I haven't had much success yet.
Re: Adding message after member registration
The Registration module has a "Redirect page" setting.
Does setting this to a (hidden) thanks page not work?
Re: Adding message after member registration
ramjet is right... you have to select a redirect page, so that the module knows which page to go to when you completed the registration process. create a new page with your thanks messages, make it hidden from navigation (but published) and then set the registration module's redirect page to this "thanks" page.
Re: Adding message after member registration
Yes, I am aware of this redirect page. I only want to have the message on the form page itself. A message above the form itself on the page. Now it looks like you would need to make a new page containing the form and the thank you message.
In my opinion this feels like unnecessary content duplication.
Any ways, if this is the only current solution for this problem. How can I make a module which solves the "issue"?
Re: Adding message after member registration
This is not an issue. It is by design:
Registration Page: Form (posts to itself, then redirects) => Thanks Page, Article: Thanks Message
Anything other than that method is not the built-in standard way.
This is also true for any FORM. When you post it, the system will redirect using the redirect to the "Thanks Page"
Not sure why you want to keep the user on the form page? They are done with the form page, no need to keep them on that page? Send them to the Thanks Page, where you can set-up and auto-redirect back to the registration page or back to the home page if you want.
Re: Adding message after member registration
Yes, sometimes you don't want to have auto redirection after a form submission. For example, for a simple newsletter subscription form on the frontpage of the site. But yes I have to admit it's more a way to learn Contao.
Re: Adding message after member registration
The newsletter form uses a Message system to display a "Thanks" message above the form. That is stored in a SESSION variable. Not all modules support this form message though... that's your hack....
Otherwise, you can always just have a button and then make a lightbox pop-up to the register and thanks pages.
Re: Adding message after member registration
I will try to find some documentation about the Message System. I guess I can use it in the createNewUser hook
Re: Adding message after member registration
I guess you could also do it client-side -- write a Mootools (or jQuery) script that blocks the default submission and instead submits it on its own using AJAX or something, then displays a message upon success.
I would still keep the separate thank you page as a fallback, though.
But a separate thank you page is pretty much a standard -- not really understanding how this is Contao's fault. :?
Re: Adding message after member registration
It's not Contao fault! Of course. I just thought this a way code way to learn how to use hooks!
Re: Adding message after member registration
Re: Adding message after member registration
Why not include the original article underneath the message on a new page. They won't be on the same url, but there is no duplication of content either.
Re: Adding message after member registration
Thanks all. Finally, chosen the redirect page to make it all easier.
Re: Adding message after member registration
But in the case, where you have catalog reader and form for quote, order, etc., than you can't use redirect if you want to stay on the same page. I will coded jquery/ajax for popup windows, but the efg should have build-in this funcion (my opinion).
Best regards!