1

Is it possible, maybe with Freemember or another free module, to choose the member group a member is assigned during registration?

I need two forms, each one assigning a different member group .

Can I do this without an add-on like Zoo Visitor or User by solspace?

Thanks in advance for your help.

4 Answers 4

3

FreeMember 2.1.1 (released today) implements this feature. You can specify the group ID in the register tag:

{exp:freemember:register group_id="5"}

You can also whitelist group IDs in the register tag parameter, then submit the group_id as a form parameter:

{exp:freemember:register group_id="5|6"}

    <select name="group_id">
        <option value="5">Author</option>
        <option value="6">Editor</option>
    </select>

{/exp:freemember:register}
3
  • Yes I know it was released, i opened the issue on github :) Thanks! Jan 1, 2013 at 19:49
  • Just updating this thread so others find the solution :) Jan 1, 2013 at 21:12
  • You did well :) Jan 1, 2013 at 21:19
2

Okay, so I just realized you were using Zoo Visitor. As @Derek Hogue, User by Solspace will handle this for you, or as I mentioned, hidden input fields on custom, but separate forms will work.

But Zoo Visitor allows for selection of user groups. I believe it also takes care of people trying to add themselves to SuperAdmin but you should also be able to strengthen the backend protocols so that only SuperAdmins can modify the SuperAdmin group. See this code from Zoo Visitor

{exp:zoo_visitor:registration_form error_handling="inline" return='account/register/success' allowed_groups="5|6"}

                Select member group:
                <select name="group_id">
                        <option value="5">Group with id 5</option>
                        <option value="6">Group with id 6</option>
                </select>

                Email*: <input id="email" name="email" type="text" value="" />
                {error:email}

                Password*: <input id="password" name="password" type="password" value="" />
                {error:password}

                Confirm password*: <input id="password_confirm" name="password_confirm" type="password" value="" />

                Member firstname: <input id="member_firstname" name="member_firstname" type="text" value="" />
                {error:member_firstname}

                Member lastname: <input id="member_lastname" name="member_lastname" type="text" value="" />
                {error:member_lastname}

                <input class="form-submit" type="submit" value="Register" />

{/exp:zoo_visitor:registration_form}

It's the Select member group section, you are interested in:

<select name="group_id">
    <option value="5">Group with id 5</option>
    <option value="6">Group with id 6</option>
</select>

Here's an example with a hidden member group

{exp:zoo_visitor:registration_form error_handling="inline" return='account/register/success' allowed_groups="5"}

        <input type="hidden" name="group_id" value="5">

        Email*: <input id="email" name="email" type="text" value="" />
        {error:email}

        Password*: <input id="password" name="password" type="password" value="" />
        {error:password}

        Confirm password*: <input id="password_confirm" name="password_confirm" type="password" value="" />

        Member firstname: <input id="member_firstname" name="member_firstname" type="text" value="" />
        {error:member_firstname}

        Member lastname: <input id="member_lastname" name="member_lastname" type="text" value="" />
        {error:member_lastname}


        <input class="form-submit" type="submit" value="Register" />

{/exp:zoo_visitor:registration_form}

Please take note that, I also limited what group_id could be used in the form. I believe Zoo Visitor uses this as a security check, incase the registrant tries to manually supply a different member group, like group_id="1" which would make them a super_admin.

When duplicating the form, you would need to change both the allowed group and the hidden field value.

4
  • I need two forms with two different member_group. So, without the select. Can you provide me an example with zoo visitor? And is possible in native mode, without zoo visitor? Thanks Dec 28, 2012 at 21:48
  • sorry for the confusion, i updated the post Dec 28, 2012 at 22:29
  • Are you using Zoo Visitor? Because if so, then you don't want to use the native inputs, because it doesn't place info into channels, it maintains its own data table. But I'll edit to provide an example in Zoo Visitor with a single member group, you can then duplicate for a second group. Dec 28, 2012 at 22:53
  • Okay, post is updated with a basic registration form, just name and password, you would need to add any other required fields, such user_name, if you aren't setting email address as user_name. Dec 28, 2012 at 23:04
1

You can set the default_member_group in your config.php file:

$config['default_member_group'] = 6;

But this will apply to all new member registrations, not just those from a particular form.

FreeMember does not allow you to choose the member group new members are assigned to.

Alternately, you could look at the User module, which does allow you to specify the member group during registration.

6
  • I need to create two forms, one per member_group. Is there another solution? Dec 28, 2012 at 20:51
  • I think the answer depends more on how you determine, which member group people get placed in. If it's something that you are allowing your members to determine themselves, then you can probably just pass the group_id as a variable to the form, setting it as a pulldown menu or something. But generally, membership is determined by some business process, so multiple forms to place people in different groups or admin assigns anyone not in primary group. Dec 28, 2012 at 20:58
  • I just revised my answer to add a link to the User module, which will do what you need (for a price). You have to be very careful when configuring different member groups during registration, so as to avoid the ability for someone to register as a Super Admin (User explicitly prevents this). Dec 28, 2012 at 21:04
  • @DerekHogue Does Zoo Visitor do the same thing? Dec 28, 2012 at 21:27
  • @nonprofit_tech "so multiple forms to place people in different groups" < I'm in this situation. Can i do this in native mode? Dec 28, 2012 at 21:29
-1

Amasing extension that finally offers custom member groups during registration !!! Member Group Assigner 2.1

1
  • Right now this appears to be a spam message, adding very little value to the conversation. Please consider adding some more detail, and removing the amasing descriptor, unless you are providing some detail as to why you think it is so amazing. Also if it is indeed your product, propriety would suggest you should say so.
    – UltraBob
    Jul 25, 2013 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.