Ibexa DXP has allowed multiple user content types for a while now, but there is no documented, native way to change the user content type used for registration based on the siteaccess.
As it turns out, it is quite easy with a bit of tweaking.
The EzSystems\EzPlatformUser\ConfigResolver\ConfigurableRegistrationContentTypeLoader
service is used by the registration process to provide the user content type used for
registration. It requires the identifier of the content type to be passed as a parameter.
We can change that parameter to a siteaccess aware one by redefining the service.
First, create as many user content types as you need.
Let's say site1user and site2user for site1 and site2.
Now, create a siteaccess aware setting for the registration content types:
parameters:
app.default.user_register_content_type: 'user'
app.site1.user_register_content_type: 'site1user'
app.site2.user_register_content_type: 'site2user'Finally, redefine the content type loader service above to use the siteaccess aware parameter instead of the standard symfony container one:
services:
EzSystems\EzPlatformUser\Form\DataMapper\UserRegisterMapper:
calls:
- [setParam, ["language", "@=service('ezpublish.config.resolver').getParameter('languages', null, null)[0]"]]And that's it. If you open /user/register on site1, it will use the site1user content type,
while it will use site2user on site2.
As it turns out, the group where registered users will be created is already siteaccess aware.
It can be changed by setting a different value for the user_registration.group_id setting
for each siteaccess.
