Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

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.

share|improve this question
add comment

4 Answers 4

up vote 3 down vote accepted

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}
share|improve this answer
    
Yes I know it was released, i opened the issue on github :) Thanks! –  migliorosso Jan 1 '13 at 19:49
    
Just updating this thread so others find the solution :) –  Adrian Macneil Jan 1 '13 at 21:12
    
You did well :) –  migliorosso Jan 1 '13 at 21:19
add comment

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.

share|improve this answer
    
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 –  migliorosso Dec 28 '12 at 21:48
    
sorry for the confusion, i updated the post –  migliorosso Dec 28 '12 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. –  nonprofit_tech Dec 28 '12 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. –  nonprofit_tech Dec 28 '12 at 23:04
    
Perfect! Thank you very much –  migliorosso Dec 28 '12 at 23:20
add comment

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.

share|improve this answer
    
I need to create two forms, one per member_group. Is there another solution? –  migliorosso Dec 28 '12 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. –  nonprofit_tech Dec 28 '12 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). –  Derek Hogue Dec 28 '12 at 21:04
    
@DerekHogue Does Zoo Visitor do the same thing? –  migliorosso Dec 28 '12 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? –  migliorosso Dec 28 '12 at 21:29
show 1 more comment

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

share|improve this answer
    
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 '13 at 8:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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