Answers.Body: <p>1) You can set the default user group through your admin:</p>
  
  <p><img src="https://i.sstatic.net/D2p2Y.png" alt="enter image description here"></p>
  
  <p>2) Also I'm pretty sure <code>&lt;input type="hidden" name="userGroups" = "1"&gt;</code> needs to be set to <code>&lt;input type="hidden" name="userGroups" value="1"&gt;</code> for it to work but I'd need to test to be sure.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-12T11:45:50.030Z
Answers.Text: Thx, I did point 1 and it worked. Point 2 didn't worked after I corrected my attributes... maybe it should be another name.
Answers.UserDisplayName: Lisa Van Daele
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-29T15:27:10.980Z
Answers.LastActivityDate: 2014-08-29T15:27:10.980Z
Answers.UserDisplayName: Adam McCombs
Body: <p>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.</p>
  
  <p>I found  <a href="https://craftcms.stackexchange.com/questions/1774/how-do-you-set-a-users-group-on-a-registration-form">this answer</a></p>
  
  <p>but don't know where to find this code.</p>
  
  <p>I'm working in a twig file. Do i have to make my own plugin for that? Or do I have to overwrite something?</p>
  
  <pre><code>&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;
  </code></pre>
  
  <p>I tried adding a userGroups hidden input but that didn't work. </p>
  
Tags: <form><registration>
Title: Registration Form twig add to an usergroup
ThreadText: # Registration Form twig add to an usergroup
  
  (Asked by: username_0 on 2014-08-29)
  
  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](https://craftcms.stackexchange.com/questions/1774/how-do-you-set-a-users-group-on-a-registration-form)
  
  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?
  
  ```
  <form method="post" action="" accept-charset="UTF-8">
      <input type="hidden" name="action" value="users/saveUser">
      <input type="hidden" name="redirect" value="/">
      <input type="hidden" name="userGroups" = "1">
  
      {% macro errorList(errors) %}
          {% if errors %}
              <ul class="errors">
                  {% for error in errors %}
                      <li>{{ error }}</li>
                  {% endfor %}
              </ul>
          {% endif %}
      {% endmacro %}
  
      {% from _self import errorList %}
  
      <h3><label for="username">Username</label></h3>
      <input id="username" type="text" name="username"
          {%- if account is defined %} value="{{ account.username }}"{% endif -%}>
  
      {% if account is defined %}
          {{ errorList(account.getErrors('username')) }}
      {% endif %}
  
      <h3><label for="email">Email</label></h3>
      <input id="email" type="text" name="email"
          {%- if account is defined %} value="{{ account.email }}"{% endif %}>
  
      {% if account is defined %}
          {{ errorList(account.getErrors('email')) }}
      {% endif %}
  
      <h3><label for="password">Password</label></h3>
      <input id="password" type="password" name="password">
  
      {% if account is defined %}
          {{ errorList(account.getErrors('password')) }}
      {% endif %}
  
      <input type="submit" value="Register">
  </form>
  
  ```
  
  I tried adding a userGroups hidden input but that didn't work.
  
  **Tags:** form, registration
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-08-29. Score: 3 | Accepted answer
  
  1) You can set the default user group through your admin:
  
  ![enter image description here](https://i.sstatic.net/D2p2Y.png)
  
  2) Also I'm pretty sure `<input type="hidden" name="userGroups" = "1">` needs to be set to `<input type="hidden" name="userGroups" value="1">` for it to work but I'd need to test to be sure.
  
  > **Comments:**
  > **username_0**: Thx, I did point 1 and it worked. Point 2 didn't worked after I corrected my attributes... maybe it should be another name.  
  
  ---
  
  