Constructor
new User(name, options)
- Source:
Create a user object.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | |
options |
object |
Methods
getGender() → {'male'|'female'|'unknown'}
- Source:
User's gender (must be obtained using module:utilsApi.loadUserGenders).
Returns:
- Type
- 'male' | 'female' | 'unknown'
getGlobalId() → {number}
- Source:
Get the user's global ID according to the database if it was set before.
Returns:
- Type
- number
getName() → {string}
- Source:
Get the user name.
Returns:
- Type
- string
getNamespaceAlias() → {string}
- Source:
Get the preferred namespace alias, based on:
- the
genderNeutralUserNamespaceAlias
CD config value (first choice); - the
userNamespacesByGender
CD config value, if the gender is known (second choice); - the
wgFormattedNamespaces
MediaWiki config value (third choice).
Returns:
- Type
- string
(nullable) getRights()
- Source:
Get the user's rights (must be obtained using module:utilsApi.getUserInfo).
isMuted() → {boolean}
- Source:
Check if the user is muted.
Returns:
- Type
- boolean
isRegistered()
- Source:
Is the user registered (not an IP user). Temporary accounts are considered registered users.
setGender(value)
- Source:
Set a gender for the user.
Parameters:
Name | Type | Description |
---|---|---|
value |
'male' | 'female' | 'unknown' |
setGlobalId(value)
- Source:
Set the user's global ID according to the database.
Parameters:
Name | Type | Description |
---|---|---|
value |
number |
setMuted(value)
- Source:
Set if the user is muted.
Parameters:
Name | Type | Description |
---|---|---|
value |
boolean |
setRights(rights)
- Source:
Set the user's rights.
Parameters:
Name | Type | Description |
---|---|---|
rights |
Array.<string> |