2

I have a User registration form:

{exp:user:register 
    return='member/register/pending'
    admin_register='yes'
    required='m_firstname|m_lastname|username|email|password|password_confirm'
    error_page='notifications/user-error'
}
        {!-- form fields --}
{/exp:user:register}

Submitting a successful form returns the correct member/register/pending template, but submitting a form with errors returns a blank page at the site's root (http://mysite.com/).

This is my error template; the {if ajax}/{if not_ajax} tags are from Mo' Variables:

{!-- Error template for the User module --}
{!-- if the template is requested with Ajax, return JSON data. Otherwise, display a normal page --}
{if ajax}
    {exp:http_header content_type='application/json'}
    {
        "success": false, 
        "heading": "{heading}", 
        "message": "{content}"
    }
{/if}

{if not_ajax}
    {embed='_global/document_head' page_title='{title}'}
    <body class="single">
    {header}

    <article class="bizness">
        <header>
            <h1>{heading}</h1>
        </header>
        {content}
        {link}
    </article>

    {footer}
    {global_scripts}
    {document_foot}
{/if}

Debugging doesn't return anything.

EE 2.6.1

User 3.4.4

2
  • 1
    What is the template code in your notifications/user-error template? Are you logged in as a Super Admin and have EE debugging set to "1" in both EE and index.php? This is to display any PHP errors if there are any.
    – Solspace
    Commented Sep 9, 2013 at 23:27
  • Template code added to question. Yes, I'm logged in as a Super Admin & EE debugging is set to "1" in both the CP and index.php. No errors at all.
    – kmgdev
    Commented Sep 10, 2013 at 15:36

1 Answer 1

3

Testing Mo'Variable's {if ajax} and {if not_ajax} conditionals in a User error template showed that the content of these conditionals do not parse, or rather parse as empty. This is the code that was used in an error template:

{if ajax}AJAX{/if}{if not_ajax}NOT AJAX{/if}

The above parsed to nothing in the error template.

Error templates bypass the native EE error message template and allow you to create and customize your own page. However, the full parsing engine might not be loaded on these special templates. Mo'Variable's conditionals might be part of what isn't loaded/reached/parseable. In fact, testing {if secure}/{if not_secure} lead to the same results (contents are parsed to nothing).

Have you tried removing the {if ajax}/{if not_ajax} conditionals from your error template? If the error template contents then appear, then it could be that Mo'Variable isn't being accessed in these special error templates.

2
  • Yeah Mo' Variables was the problem. Too bad, was hoping to use ajax on that form...
    – kmgdev
    Commented Sep 11, 2013 at 17:07
  • Solspace, perhaps it would be wise to mention this in the documentation for the error_page so that in the future, users of your module will be aware of this odd behavior. I'm currently working through the same issue. In my case it was Stash and the templating engine that wasn't being loaded properly.
    – nageeb
    Commented Sep 4, 2014 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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