Add Functionality to User Module

Feb 10, 2011 at 10:59 PM

Hello I am new to orchard and Iv had a bash at the following but I missing some thing, so I am asking for a fresh pair of eyes 
and how some one else would do the following. 

I am creating a module to add settings to an orchard user.
- What do i need to do in the migrations file to alter the existing UserPartRecord table to include new fields (ie IsLocked)
- How do I inject these setting in to the user add/edit page and make sure these settings are saved to database

examples would be good

Thanks for any help

Feb 10, 2011 at 11:04 PM

You shouldn't alter the existing UserPartRecord: this is owned by the module that defines it. Instead, you should add your own part to the user content type.

There is already a user profile module on the gallery:

Feb 11, 2011 at 2:15 PM

Thanks for getting back so quick, wish I had stayed on-line. OK so I wont change the existing user and instead create a 1-1 relationship, in database terms.

Like so: (Correct me if im wrong or could do it better)


                  table => table
                      .Column<bool>("IsHappyUser", c => c.WithDefault(false))

                cfg => cfg

Then create a ActiveDirectoryUserPartHandler class to inject the setting in to the user add/edit page

            Filters.Add(new ActivatingFilter<MyUserPart>("User"));
            Filters.Add(new TemplateFilterForRecord<MyUserPartRecord>("MyUserSettings", "Parts/MyUser.MyUserSettings"));


Awesome I have now got it working. It was the migration part i was doing incorrectly

Thanks for your help