Registration Form twig add to an usergroup I just started using Craft and I'm a little stuck with a public registration form.
I made a user group and wanted to add these to the saveUser form.

I found  this answer

but don't know where to find this code.

I'm working in a twig file. Do i have to make my own plugin for that? Or do I have to overwrite something?

&lt;form method="post" action="" accept-charset="UTF-8"&gt;
    &lt;input type="hidden" name="action" value="users/saveUser"&gt;
    &lt;input type="hidden" name="redirect" value="/"&gt;
    &lt;input type="hidden" name="userGroups" = "1"&gt;

    {% macro errorList(errors) %}
        {% if errors %}
            &lt;ul class="errors"&gt;
                {% for error in errors %}
                    &lt;li&gt;{{ error }}&lt;/li&gt;
                {% endfor %}
            &lt;/ul&gt;
        {% endif %}
    {% endmacro %}

    {% from _self import errorList %}

    &lt;h3&gt;&lt;label for="username"&gt;Username&lt;/label&gt;&lt;/h3&gt;
    &lt;input id="username" type="text" name="username"
        {%- if account is defined %} value="{{ account.username }}"{% endif -%}&gt;

    {% if account is defined %}
        {{ errorList(account.getErrors('username')) }}
    {% endif %}

    &lt;h3&gt;&lt;label for="email"&gt;Email&lt;/label&gt;&lt;/h3&gt;
    &lt;input id="email" type="text" name="email"
        {%- if account is defined %} value="{{ account.email }}"{% endif %}&gt;

    {% if account is defined %}
        {{ errorList(account.getErrors('email')) }}
    {% endif %}

    &lt;h3&gt;&lt;label for="password"&gt;Password&lt;/label&gt;&lt;/h3&gt;
    &lt;input id="password" type="password" name="password"&gt;

    {% if account is defined %}
        {{ errorList(account.getErrors('password')) }}
    {% endif %}

    &lt;input type="submit" value="Register"&gt;
&lt;/form&gt;


I tried adding a userGroups hidden input but that didn't work.
1) You can set the default user group through your admin:



2) Also I'm pretty sure &lt;input type="hidden" name="userGroups" = "1"&gt; needs to be set to &lt;input type="hidden" name="userGroups" value="1"&gt; for it to work but I'd need to test to be sure.