user1482852
user1482852

Reputation: 94

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..

Upvotes: 1

Views: 1880

Answers (1)

Mark
Mark

Reputation: 3271

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

Upvotes: 2

Related Questions