Search code examples
umbraco7membership

Add additional fields in Umbraco membership profile


I am developing a site using Umbraco 7 where HomePage has a Signup form with several fields. I have created a partial View using Register Member Template and call the Partial View on my HomePage. Everything is working fine but i need to add some extra fields in the form(like Last name, Phone no., Address etc). Is there any way to modify existing Member Profile Model to add these fields? I am new to Umbraco so any help will be appreciated..


Solution

  • You'll want to add the properties to the membertype.

    Mark them as editable:

    enter image description here

    Finally output them in your view:

    for (var i = 0; i < registerModel.MemberProperties.Count; i++)
    {
       <div class="form-group">
           <label for="@Html.IdFor(m => registerModel.MemberProperties[i].Value)">
               @registerModel.MemberProperties[i].Name
               @Html.HiddenFor(m => registerModel.MemberProperties[i].Alias)
           </label>
           @Html.EditorFor(m => registerModel.MemberProperties[i].Value, new { htmlAttributes = new { @class = "form-control" } })
       </div>
    }
    

    Note: registerModel is of type Umbraco.Web.Models.RegisterModel

    Also check out UmbracoIdentity, a great open source package that shows how to handle member related functionality