TransWikia.com

Freeform user account creation form: handling prior user account exists

Craft CMS Asked on December 10, 2020

This is more or less a duplicate of a support ticket raised with Solspace. I’ve no doubt they will provide an answer but if anyone else has one feel free to pitch in.


I’m using Freeform forms to register user accounts into a specific user group per form. It could arise that a would-be user is already registered, so I need to handle them trying to create a user account for an email address already in the system.

It appears that form.hasErrors prevents a duplicate account being created but doesn’t return any message that that’s what has happened within the form.errors loop.

I’m imagining I could do something like the following to assume that a prior user account is the issue, but it would be good if there was something more systematically robust:

{% if form.hasErrors %}
    {% if form.errors|length %}
        {# Report errors #}
    {% else %}
        {# Assume that an existing user account is the issue #}
    {% endif %}
{% endif %}

Is there a better way?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP