I’m working over this module (Extended Registration). This module provides a simple way of showing custom user fields in the registration.
Overrides the AccountController form user and loads the Editor Template in the Registration template
AccountController
var shape = _orchardServices.New.Register();
var user = _orchardServices.ContentManager.New("User");
if (user != null) {
shape.UserProfile= _contentManager.BuildEditor(user);
}
return new ShapeResult(this, shape);
Register.cshtml
</div>
@if (Model.OERegister != null) {
<fieldset>
@Display(Model.UserProfile)
</fieldset>
}
<div>
The shape here is the Editor Template (EditorTemplate/Parts/template)
It Works just fine, but I need to hide some fields from the registration form.
I’m kind of lost here, and I want to do it in the most Orchish way.
Thanks in advance.
As far as I understand the question here is how to generally hide some fields from a form.
Depending on how the author of the form’s code designed it or whether you’re the developer, there are multiple ways:
BTW I don’t think the ContentManager.New() can ever return null. Even if the content type is not statically defined (i.e. created from a migration or through ContentDefinitionManager) it will return a content item.