My question really is, is it okay to extend the _user table, or must I absolutely use an extension table (ie., _user_extensions) to keep all my extra fields in? From what I can see, extending the _user table and then upgrading shouldn't be a problem, since the upgrade scripts generally extend tables, and don't recreate them, so extra, unexpected fields wouldn't be a problem. Having an extra table just means another join or something similar to get all the data, and according to SQL theory (whatever that was worth) they should be held in one table, since its a 1:1 link with a shared primary key.
Any definitive advice from the powers that be?
I could see it being handy to have a table with records like:
(user number) (key) (value)
Where key and value are arbitrary text. Then the user profile dialog could iterate through these and generate the appropriate fields for the user to fill in.
If you wanted to add a new field to the user profile, say, AOL IM id, you could just generate a record in the extension table for every user with the key "AIM ID" (there'd need to be some method to create these automatically for new users, of course).
Or am I totally off base here?
I think the real question I'm trying to pose is, is it safe to extend the table? Or is there a reason I should rather do it completely seperately, which I'm currently not seeing?
Hello,
I hope that you can use my post with Skype integration:
http://moodle.org/mod/forum/discuss.php?d=17006
As an example of how to ad user fields.
I have tried to document every step, so that it can be used as a lesson to add fields in general.
BR
Jens Gammelgaard
Take a look at the functions in moodlelib.php to set/get the values, or roll up your sleeves and do the JOINs like Real Men Do ;)
Using get/set_user_preferences, I have added a "state" field whose values are stored in mdl_user_preferences. It works great for manual input...but it is not getting updated via enrolment plugin/external database. Which additional files need to be edited in order for this field to be automatically populated/updated upon login?
ok so that make no sense to me..
How do I get rid of fields... We use moodle in house, so the need for country , location, description phone are not needed.. All I need is Name and Email.. Now if I could get AD SSO working, it would be great back I can't I've tried everything,, So POP3 auth works back to our exchange server...
I can find where to add more fields to the profile, but how can I get rid of them.. or even just make it so they aren't required...
In admin/auth.php? you can lock certain fields. I am not sure if that makes them disappear but I guess so.
I hacked my user/edit.html to make the profile minimalistic in the days when locking was not possible.