As designed {$isAwaitingEmailConfirmation} conditional not working on account_upgrades template


Active member
Not sure if this is a bug, by design, or just my own silly issue (tested on 2 xf installs, one prod one dev, same result) but I can't seem to use the {$isAwaitingEmailConfirmation} template conditional on the account_upgrades template.

Using the following to test:
<xen:if is="{$isAwaitingEmailConfirmation}">

When placed on the PAGE_CONTAINER template and viewed on an unconfirmed account, the 'testing' message shows as expected.

When placed on the account_upgrades template and again viewed on an unconfirmed account, the 'testing' message does not show.

I also tested it on one of my own templates for an addon of mine and it worked there too. No idea why it isn't functioning on account_upgrades or if it doesn't work on other default XF templates as well.

If anyone knows how to get it working please let me know. Thanks.
That's a container param. It's not available to the content template without an addon. But you could create a condition to check the {$visitor} array in the template. This is what that var uses:

$params['isAwaitingEmailConfirmation'] = ($visitor['user_id'] && in_array($visitor['user_state'], array('email_confirm', 'email_confirm_edit')));
Yeah unfortunately just because a parameter is available in the PAGE_CONTAINER template, doesn't necessarily mean it will be available to others. And that is basically the problem.

That conditional is only available to the PAGE_CONTAINER template. It is defined as a parameter in XenForo_Dependencies_Public which sets up all of the parameters for the PAGE_CONTAINER.

You have a couple of options:

1) Create an add-on which extends the View which is defined for the account_upgrades controller (XenForo_ViewPublic_Account_Upgrades) and define that parameter. This will make it useable in that template.
2) Add another conditional in PAGE_CONTAINER something like (syntax may be wrong, going from memory)

<xen:if is="{$contentTemplate} == 'account_upgrades'>[/S]
[S]<xen:if is="{$isAwaitingEmailConfirmation}">[/S]
[S]Do something[/S]

This will obviously only work if what you're wanting to do can be injected somewhere within the PAGE_CONTAINER (so before or after the account_upgrades template is rendered).

Hehe, yeah what Jake the ninja said. Much more elegant actually.

The actual condition you should be able to use in the template is:

<xen:if is="{$visitor.user_state} == 'email_confirm' || {$visitor.user_state} == 'email_confirm_edit'">
	Do some stuff
Thank you both for taking the time to explain and help me out, really appreciate it. And thanks for the conditional Chris, you made solving my issue extremely easy, tested & it works. :)
Top Bottom