I'm working with version 8.x-1.0-alpha2 in a multilingual project.

I'm trying to have people register and create contacts of 2 types, "seller" and "buyer", dépending on the url they enter.

I'm loosely interpreting what I can see on admin/config/redhen/contact:

Allowed contact type
Select the allowed contact types to create during registration. This can be overridden by appending the contact type machine name in the registration url.

Not sure what is appending the contact type to the url... should I use ?q=contact_type ? or a simple "/"

In redhen_contact.module

 83     // Get menu item to check for overridden Contact Type parameter, but only
 84     // when a user is registering from user/register.
 85     $url_exploded = array_slice(explode('/', \Drupal::request()->getRequestUri()), 1);
 86     if ($url_exploded[0] == 'user' && $url_exploded[1] == 'register' && isset($url_exploded[2])) {
 87       $contact_type = $url_exploded[2];
 88     }
 89     else {
 90       // If a parameter was not passed, use the default contact type.
 91       $contact_type = $config->get('registration_type');
 92     }

I guess I should use user/register/seller to get the seller contact created, the same with user/register/buyer...

I does not seem to work, any contact created is the default one.

Adding the $contact_type as last arg I end up on a 404...

I note that the $url_exploded returned the language prefix as first member of the array...

What am I doing wrong ?

Comments

Marc Angles created an issue. See original summary.

Marc Angles’s picture

Issue summary: View changes
arosboro’s picture

I had to make a path alias to /user/register like /user/register/teacher, for example, and then the machine name teacher will be embedded for the contact entry.

Marc Angles’s picture

@arosboro

Thanks a lot for the tip. It is working.

arosboro’s picture

Title: Creating contacts (of different types) via register form » Document process for Creating contacts (of different types) via register form
Category: Support request » Task

I'm changing the title of this, because it works as designed, but could use some documentation to explain how to use this functionality.

Marc Angles’s picture

I think I spoke a bit too quickly.

It does not seems to work in a multilingual site...

mgifford’s picture

@Marc Angles - is it just the register form or RedHen in general which you're having trouble working in a multilingual site?