Assigning Member Group on Member Creation

Been looking all over for a solution to this.

Using the new
var registerModel = Members.CreateRegistrationModel();

Basicall on an order confirmation page I want to allow the person to create themselves as a memeber by using the existing parameters and entering a password.

I want them to have instant access to a member group.

I can get them registered without custom properties (I’ll get to that later)

But what I can’t do is assing them to a group.

Is there any way to do this in the control “Register Member” which is supplied with umbraco.

Also..

In the script it itterates through custom properties. With the following.

 @if (registerModel.MemberProperties != null)
            {
                for (var i = 0; i < registerModel.MemberProperties.Count; i++)
                {
                    @Html.LabelFor(m => registerModel.MemberProperties[i].Value, registerModel.MemberProperties[i].Name)
                    @* 
                        By default this will render a textbox but if you want to change the editor template for this property you can 
                        easily change it. For example, if you wanted to render a custom editor for this field called "MyEditor" you would
                        create a file at ~/Views/Shared/EditorTemplates/MyEditor.cshtml", then you will change the next line of code to 
                        render your specific editor template like:
                        @Html.EditorFor(m => profileModel.MemberProperties[i].Value, "MyEditor")
                    *@
                    @Html.EditorFor(m => registerModel.MemberProperties[i].Value)
                    @Html.HiddenFor(m => registerModel.MemberProperties[i].Alias)
                    <br />
                }
            }

Hoever I want to simply fill in two fields memberFirstName and memberLastName.

I can’t work out how to just edit the fields by thier alias name

LIKE…

 @if (registerModel.MemberProperties != null)
            {
              
 @Html.HiddenFor(m => registerModel.MemberProperties.Alias("memberFirstName"), new {@Value = @memFirstName})


            }

Obvioulsy that doenst work but is there anyway to send the data directly without the form fields in the itteration.

Kind Regards

Doogie


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/72200-assigning-member-group-on-member-creation