Manual:User preferences

Retrieving user preferences
To retrieve all of a user's preferences, use User::getOptions.

To retrieve a specific preference of a user, use User::getOption with the name of the preference as a parameter, for example:

If the preference is of the multiselect or checkmatrix type, the parameter will be . For example, if the preference name is 'searchNs' and the option value is '2', the parameter for getOption will be 'searchNs2'. There is an exception to this, however: If the preference specifies an explicit option prefix, that prefix will be used instead of the preference name (). See the Gadgets extension for an example.

To retrieve it in JavaScript, use the user.options module.

Setting default preferences
For information about how to set default preferences for all users, see Manual:$wgDefaultUserOptions.

Changing a preference
Preferences can be changed through the options API action.

Creating a preferences interface
For information about creating a preferences interface for your features, see Manual:Hooks/GetPreferences.

Gadget and user script preferences
Any gadget or user script can define a preference, the name of which must start with 'userjs-'. This will not appear in Special:Preferences or be validated, but it can be read from user.options, and set through API:Options.

Hidden API preferences
API preferences are defined through the GetPreferences hook, with the type set to 'api'. They are validated and readable the normal ways, but are not part of Special:Preferences.

Disabling user preferences
To prevent users from editing their preferences, you can use the User right editmyoptions. With this line in your, users in the group user (all logged in users) can't edit their user preferences: