OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.36k stars 2.37k forks source link

Register Page with Extra fields #3435

Closed aghili371 closed 4 months ago

aghili371 commented 5 years ago

I want to have register Page With Extra field like(name, address, phone,...) i should get a clone from OrchardCore.Users Module and redesign controller and views or you have a better solution?

sebastienros commented 5 years ago

You can already change the view by copying it in your theme (or module) in the Views\OrchardCore.Users\Registration folder.

Then there is an interface in the OrchardCore.Users.Abstractions that is named IRegistrationFormEvents that will let you execute some custom code when the form is validated and the user is created. You will need to resolve the current http request and access the form by yourself. Also you will need to query the user from the user store and then update its data (or store it somewhere else). If you use the User class it has a Properties object that you can use to store custom data.

Maybe we should add more properties to these events to simplify your work but it looks totally doable.

Let us know how it goes.

For my own reference, this is how it's done in WP: https://codex.wordpress.org/Customizing_the_Registration_Form

sebastienros commented 5 years ago

I think this issue will also help you: https://github.com/OrchardCMS/OrchardCore/issues/3353

aghili371 commented 5 years ago

this project is good for redesign the user pages. ModernBusiness.OC.RazorPages

just I have a problem, how I can tell the page to use the default layout in my theme ("Layout.liquid")?

aghili371 commented 5 years ago

i used "properties " to save extra fields, it works fine but when i want to have listed and edit the information, it was difficult to use. i created new content type "user info" and i added the field here.

the problem is how to connect this content type and "user register info".

i you set an extra field in the identity of the user to get the user id, it will be great.

i can get the username by : User.Identity.Name;

do you have any field to get userid?