0

If I disable Allow New Member Registrations, and a user goes to the Registration page, the error page is not displayed, but instead is embedded within the registration page, occupying the location where the registration form once was displayed.

Seems the error re-routing isn't working when Allow New Member Registrations is disabled.

Error re-routing does work for all other functions with USER

How can I get the error page to display correctly when registrations are disabled?

0

I'll go on a guess that you are using the Demo Templates that are provided with User. In this case, {exp:user:register} uses an error_page="" parameter to display, on form submission, an error page based on a template set in the parameter. In the Demo Templates, it would be user_inc/error_template (assuming you used user_ as your Demo Templates prefix). This template contains embeds for a header, sidebar, footer, etc. This gives you a well-formatted error page when submitting the registration form with errors.

When you visit the registration form as-is (i.e. no form submission yet), the error_page="" is already triggered when "Allow New Member Registrations" is disabled, and the error page template content is pulled in and placed where your registration form would usually be. That means the error page's header, sidebar, footer embeds are also being added to the template, breaking the layout.

We'll make a note of this behaviour and see how we can improve this in the future, but you can get around that issue by adding conditionals in user_inc/error_template to not display header, sidebar, footer code when the URL contains register in it. Eg.

{if segment_2 != "register"}
  // This will only display when on an error page
  // i.e. on a page following a form submission
  // eg. {embed="user_inc/index" page_title="{title}"}
{/if}

That way, if you view the registration form, header, sidebar, footer, etc code will not be pulled in form the error page template, but when you submit the form with errors, you'll have a formatted error page, with header, sidebar, footer, etc.

| improve this answer | |

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.