Manual:User preferences/zh

Retrieving user preferences
To retrieve all of a user's preferences, use UserOptionsLookup::getOptions with a user identity object as a parameter.

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

If the preference is of the multiselect or checkmatrix type, the parameter will be &lt;preference-name>&lt;option-value>. 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 (&lt;prefix-name>&lt;option-name>). See the Gadgets extension for an example.

To retrieve it in JavaScript, use the module.



设置默认参数设置
有关如何设置所有用户的默认参数设置，参见.



修改参数设置界面
可以通过 API操作更改首选项.



创建参数设置界面
有关为功能创建首选项界面的信息，请参阅.



小工具和用户脚本参数设置
Any gadget or user script can define a preference, the name of which must start with " ". Such a preference will not appear in Special:Preferences or in responses, and it will not be validated. It can be read from, and set through.



隐藏API参数设置
API preferences are also defined through the GetPreferences hook, with the type set to. They are validated and readable the normal ways, but are not part of the Special:Preferences form.



禁用用户参数设置


按偏好
To disable individual preferences for all users, add preference names to the configuration variable. For example, to prevent everyone from being able to mark their edits minor by default, set the following in your :



按用户组
To prevent individual user groups from editing their preferences, you can use the 'editmyoptions'. With this line in your, users in the group 'user' (which contains all logged in users) can't edit their user preferences:



按用户
无法仅禁用特定用户的参数设置.



参见

 * – 用户文档参数设置
 * – 跨维基管理参数设置的扩展
 * - 存储用户参数设置