# Usage with User Registration

If you set 4allportal-agb.login_agb.check_agb_on_login to "true", your users need to accept the Terms of Use before being able to log in the first time. If you are using 4App User Registration, you can also implement this option in the self-registration wizard. This way, self-registering users can accept the Terms of Use right there.

For this, you need to:

  1. Create a new boolean field in module "User Registration".
  2. Implement it via a renderer of type "agb" in the User Registration form.
  3. Customize the required contents in a properties file, if required.
  4. Map the new field to Terms of Use field agb_confirmed.

User Registration documentation (opens new window)

Please note: The Terms of Use link(s) defined in the init.json will be displayed on the user registration form regardless of your accept settings.

# 1. Create a New Field

In order to store the acceptance of the Terms of Use per user, you need to create a new field:

  1. Go to admin snap-in Module configurations/User Registration/Fields.
  2. Create a new field of type Boolean and name it e.g. "user_reg_agb_confirmed".
  3. Save your settings and reload the system.

# 2. Implement New Field in the Registration Form

In order to display this new field in the registration form, you need to add a field renderer of type agb (i.e. "Terms of Use") to the corresponding default renderer:

  1. The three default register_form renderers can be found in 4App "User Registration", folder application/html/4allportal-user_registration.
  2. Copy the register_form renderer you want to add the field to (e.g. register_form_3.4aprenderer if you want to add the field on the third form page).
  3. Create and open the following folder in your custom folder:application/html/4allportal-user_registration. Paste the complete register_form renderer here.
  4. Add the following field renderer on the desired position:
<field_renderer>
  <type>Agb</type>

  <label>L-GLOBAL-AGB_LINK</label>
  <info>L-GLOBAL-AGB_LINK</info>

  <validation>
    <not_null>true</not_null>
  </validation>

  <field_renderer_attributes>
    <entry key="agb_label_key">L-GLOBAL-AGB-SHORT_TEXT</entry>
  </field_renderer_attributes>

  <field>
    <name>user_reg_agb_confirmed</name>
    <type>CEBoolean</type>
  </field>
</field_renderer>

Result in the GUI:

Please note: You need to copy the whole default .4aprenderer file. A change will not work in this case.

# 3. Customize the Label Texts

In tag <field_renderer_attributes>, you can insert one of the following keys:

Key Description
agb_label_key default key: L-GLOBAL-AGB-SHORT_TEXT
Displays the text with the link defined in info_popup_key (default: Terms of Use pop-up).
agb_error_key default key: L-GLOBAL-AGB_RENDERER-AGB_NOT_CHECKED-ERROR
Displayed if the field was not clicked when validating.
info_popup_key default pop-up: agb (Terms of Use)
Defines where the link should point to. Default is Terms of Use, but a custom link (e.g. imprint or another link) can be defined, too, if configured.

The default translations and can be found here. If required, you can customize the translations or the keys themselves, if you created custom keys.

# 4. Map Acceptance to User Module

As soon as a user registers themselves via the registration form and accepts the Terms of Use, this value is stored in your custom field (in our example: user_reg_agb_confirmed). If you want to map this information to agb field agb_confirmed, you need to define this in the User registration configuration:

  1. Go to admin snap-in General system configurations/User settings/User registration.
  2. In field "Field mapping with the Users module", add your new field on the left side and map it to field "agb_confirmed" on the right side.
  3. Save your settings and reload the system.

Please note: Field agb_confirmed is not displayed in the GUI by default. You can add it to the metadata renderer of module "User" via an object renderer change. Admins could then manually reset a user's acceptance if they updated the Terms of Use (more details).

Request missing documentation