Manual:Hooks/GetPreferences

Example
In :

In :

Tabs and sections
The   array key specifies which tab and section of  contains your preferences. If your   value is foo/bar, this means your preference will appear on the foo tab (named by system message  ) within the bar section (named by system message  ). If no such tab or section exists, it is created automatically.

Visible types
The type can take on various values found in the   array in the file , including,  ,  , etc.

Most preferences are stored in the same format as is used by the HTMLFormField, but in the case of <tvar|2> </> a transformation should be carried out from a newline-separated list of usernames (which is what the form widget works with) and a newline-separated list of user IDs (which is what gets stored in the database).

See the treatment of <tvar|1> </> (in core) or <tvar|2> </> (in <tvar|3></>) for examples of this.

API preferences
API preferences use type 'api'. They are not displayed in Special:Preferences.

Default preferences
To set the default value for a preference (i.e. the value that is set for a new user that hasn't customized their preferences yet), add the setting to the <tvar|DefaultUserOptions></> global variable. Use the same key name as you use for $preferences in the hook.

Alternatively, if you're writing an extension, you can add to the <tvar|1>DefaultUserOptions</> section of the file extensions.json.