This is one of the most interesting learning point for me to add a user field in site definition. Because while doing so I understood a lot of things about site definition and how it works.
Okay, the main point is to add user field in site definition, so let's get started.
For this we have to create a site definition and then a list definition and finally a user field.
1. Creating empty solution
2. Adding site definition project
- Solution explorer
3. Adding list definition
4. List Definition settings
5. Changing the list definition (elements.xml file)
6. Changing the list schema in schema.xml file
7. Amending the one.xml (site schema)
8. Getting the feature ID
9. Deploy the project
10. Go to central administration and click on "Create site collections"
11. Specify site collection details
12. Site created successfully
13. Open the site
14. Click on "All Site Content" and click on the List name that we have just created
15. Then click on "Add new item" and you can see the user field that we have created
16. Displaying added data
That's it, and we are done with it.
Hope this will help you guys.