MediaWiki  REL1_22
User Class Reference

The User object encapsulates all of the user-specific settings (user_id, name, rights, password, email address, options, last login time). More...

Inheritance diagram for User:
Collaboration diagram for User:

List of all members.

Public Member Functions

 __construct ()
 Lightweight constructor for an anonymous user.
 __toString ()
 addAutopromoteOnceGroups ($event)
 Add the user to the group if he/she meets given criteria.
 addGroup ($group)
 Add the user to the given group.
 addNewUserLogEntry ($action=false, $reason= '')
 Add a newuser log entry for this user.
 addNewUserLogEntryAutoCreate ()
 Add an autocreate newuser log entry for this user Used by things like CentralAuth and perhaps other authplugins.
 addToDatabase ()
 Add this existing user object to the database.
 addWatch ($title, $checkRights=WatchedItem::CHECK_USER_RIGHTS)
 Watch an article.
 blockedBy ()
 If user is blocked, return the name of the user who placed the block.
 blockedFor ()
 If user is blocked, return the specified reason for the block.
 canReceiveEmail ()
 Is this user allowed to receive e-mails within limits of current site configuration?
 canSendEmail ()
 Is this user allowed to send e-mails within limits of current site configuration?
 changeableGroups ()
 Returns an array of groups that this user can add and remove.
 checkPassword ($password)
 Check to see if the given clear-text password is one of the accepted passwords.
 checkTemporaryPassword ($plaintext)
 Check if the given clear-text password matches the temporary password sent by e-mail for password reset operations.
 clearAllNotifications ()
 Resets all of the given user's page-change notification timestamps.
 clearInstanceCache ($reloadFrom=false)
 Clear various cached data stored in this object.
 clearNotification (&$title)
 Clear the user's notification timestamp for the given title.
 confirmEmail ()
 Mark the e-mail address confirmed.
 doLogout ()
 Clear the user's cookies and session, and reset the instance cache.
 editToken ($salt= '', $request=null)
 Alias for getEditToken.
 getAutomaticGroups ($recache=false)
 Get the list of implicit group memberships this user has.
 getBlock ($bFromSlave=true)
 Get the block affecting the user, or null if the user is not blocked.
 getBlockId ()
 If user is blocked, return the ID for the block.
 getBoolOption ($oname)
 Get the user's current setting for a given option, as a boolean value.
 getDatePreference ()
 Get the user's preferred date format.
 getEditCount ()
 Get the user's edit count.
 getEditToken ($salt= '', $request=null)
 Initialize (if necessary) and return a session token value which can be used in edit forms to show that the user's login credentials aren't being hijacked with a foreign form submission.
 getEffectiveGroups ($recache=false)
 Get the list of implicit group memberships this user has.
 getEmail ()
 Get the user's e-mail address.
 getEmailAuthenticationTimestamp ()
 Get the timestamp of the user's e-mail authentication.
 getFirstEditTimestamp ()
 Get the timestamp of the first edit.
 getFormerGroups ()
 Returns the groups the user has belonged to.
 getGroups ()
 Get the list of explicit group memberships this user has.
 getId ()
 Get the user's ID.
 getIntOption ($oname, $defaultOverride=0)
 Get the user's current setting for a given option, as an integer value.
 getName ()
 Get the user name, or the IP of an anonymous user.
 getNewMessageLinks ()
 Return the data needed to construct links for new talk page message alerts.
 getNewMessageRevisionId ()
 Get the revision ID for the last talk page revision viewed by the talk page owner.
 getNewtalk ()
 Check if the user has new messages.
 getOption ($oname, $defaultOverride=null, $ignoreHidden=false)
 Get the user's current setting for a given option.
 getOptionKinds (IContextSource $context, $options=null)
 Return an associative array mapping preferences keys to the kind of a preference they're used for.
 getOptions ()
 Get all user's options.
 getPageRenderingHash ()
 Generate a string which will be different for any combination of user options which would produce different parser output.
 getPasswordValidity ($password)
 Given unvalidated password input, return error message on failure.
 getRealName ()
 Get the user's real name.
 getRegistration ()
 Get the timestamp of account creation.
 getRequest ()
 Get the WebRequest object to use with this object.
 getRights ()
 Get the permissions this user has.
 getSkin ()
 Get the current skin, loading it if required.
 getStubThreshold ()
 Get the user preferred stub threshold.
 getTalkPage ()
 Get this user's talk page title.
 getTitleKey ()
 Get the user's name escaped by underscores.
 getToken ($forceCreation=true)
 Get the user's current token.
 getTokenFromOption ($oname)
 Get a token stored in the preferences (like the watchlist one), resetting it if it's empty (and saving changes).
 getTouched ()
 Get the user touched timestamp.
 getUserPage ()
 Get this user's personal page title.
 getWatchedItem ($title, $checkRights=WatchedItem::CHECK_USER_RIGHTS)
 Get a WatchedItem for this user and $title.
 idForName ()
 If only this user's username is known, and it exists, return the user ID.
 incEditCount ()
 Increment the user's edit-count field.
 inDnsBlacklist ($ip, $bases)
 Whether the given IP is in a given DNS blacklist.
 invalidateCache ()
 Immediately touch the user data cache for this account.
 invalidateEmail ()
 Invalidate the user's e-mail confirmation, and unauthenticate the e-mail address if it was already confirmed.
 isAllowed ($action= '')
 Internal mechanics of testing a permission.
 isAllowedAll ()
 isAllowedAny ()
 Check if user is allowed to access a feature / make an action.
 isAllowedToCreateAccount ()
 Get whether the user is allowed to create an account.
 isAnon ()
 Get whether the user is anonymous.
 isBlocked ($bFromSlave=true)
 Check if user is blocked.
 isBlockedFrom ($title, $bFromSlave=false)
 Check if user is blocked from editing a particular article.
 isBlockedFromCreateAccount ()
 Get whether the user is explicitly blocked from account creation.
 isBlockedFromEmailuser ()
 Get whether the user is blocked from using Special:Emailuser.
 isBlockedGlobally ($ip= '')
 Check if user is blocked on all wikis.
 isDnsBlacklisted ($ip, $checkWhitelist=false)
 Whether the given IP is in a DNS blacklist.
 isEmailConfirmationPending ()
 Check whether there is an outstanding request for e-mail confirmation.
 isEmailConfirmed ()
 Is this user's e-mail address valid-looking and confirmed within limits of the current site configuration?
 isHidden ()
 Check if user account is hidden.
 isItemLoaded ($item, $all= 'all')
 Return whether an item has been loaded.
 isLocked ()
 Check if user account is locked.
 isLoggedIn ()
 Get whether the user is logged in.
 isNewbie ()
 Determine whether the user is a newbie.
 isPasswordReminderThrottled ()
 Has password reminder email been sent within the last $wgPasswordReminderResendTime hours?
 isPingLimitable ()
 Is this user subject to rate limiting?
 isValidPassword ($password)
 Is the input a valid password for this user?
 isWatched ($title, $checkRights=WatchedItem::CHECK_USER_RIGHTS)
 Check the watched status of an article.
 load ()
 Load the user table data for this object from the source given by mFrom.
 loadDefaults ($name=false)
 Set cached properties to default.
 loadFromDatabase ()
 Load user and user_group data from the database.
 loadFromId ()
 Load user table data, given mId has already been set.
 loadFromRow ($row, $data=null)
 Initialize this object from a row from the user table.
 logout ()
 Log this user out.
 matchEditToken ($val, $salt= '', $request=null)
 Check given value against the token value stored in the session.
 matchEditTokenNoSuffix ($val, $salt= '', $request=null)
 Check given value against the token value stored in the session, ignoring the suffix.
 pingLimiter ($action= 'edit', $incrBy=1)
 Primitive rate limits: enforce maximum actions per time period to put a brake on flooding.
 removeGroup ($group)
 Remove the user from the given group.
 removeWatch ($title, $checkRights=WatchedItem::CHECK_USER_RIGHTS)
 Stop watching an article.
 requiresHTTPS ()
 Determine based on the wiki configuration and the user's options, whether this user must be over HTTPS no matter what.
 resetOptions ($resetKinds=array( 'registered', 'registered-multiselect', 'registered-checkmatrix', 'unused'), IContextSource $context=null)
 Reset certain (or all) options to the site defaults.
 resetTokenFromOption ($oname)
 Reset a token stored in the preferences (like the watchlist one).
 saveSettings ()
 Save this user's settings into the database.
 saveToCache ()
 Save user data to the shared cache.
 sendConfirmationMail ($type= 'created')
 Generate a new e-mail confirmation token and send a confirmation/invalidation mail to the user's given address.
 sendMail ($subject, $body, $from=null, $replyto=null)
 Send an e-mail to this user's account.
 setCookies ($request=null, $secure=null)
 Set the default cookies for this session on the user's client.
 setEmail ($str)
 Set the user's e-mail address.
 setEmailAuthenticationTimestamp ($timestamp)
 Set the e-mail authentication timestamp.
 setEmailWithConfirmation ($str)
 Set the user's e-mail address and a confirmation mail if needed.
 setId ($v)
 Set the user and reload all fields according to a given ID.
 setInternalPassword ($str)
 Set the password and reset the random token unconditionally.
 setName ($str)
 Set the user name.
 setNewpassword ($str, $throttle=true)
 Set the password for a password reminder or new account email.
 setNewtalk ($val, $curRev=null)
 Update the 'You have new messages!' status.
 setOption ($oname, $val)
 Set the given option for a user.
 setPassword ($str)
 Set the password and reset the random token.
 setRealName ($str)
 Set the user's real name.
 setToken ($token=false)
 Set the random token (used for persistent authentication) Called from loadDefaults() among other places.
 spreadAnyEditBlock ()
 If this user is logged-in and blocked, block any IP address they've successfully logged in from.
 useNPPatrol ()
 Check whether to enable new pages patrol features for this user.
 useRCPatrol ()
 Check whether to enable recent changes patrol features for this user.
 validateCache ($timestamp)
 Validate the cache for this account.

Static Public Member Functions

static changeableByGroup ($group)
 Returns an array of the groups that a particular group can add/remove.
static comparePasswords ($hash, $password, $userId=false)
 Compare a password hash with a plain-text password.
static createNew ($name, $params=array())
 Add a user to the database, return the user object.
static crypt ($password, $salt=false)
 Make a new-style password hash.
static edits ($uid)
 Count the number of edits of a user.
static generateToken ()
 Generate a looking random token for various uses.
static getAllGroups ()
 Return the set of defined explicit groups.
static getAllRights ()
 Get a list of all available permissions.
static getCanonicalName ($name, $validate= 'valid')
 Given unvalidated user input, return a canonical username, or false if the username is invalid.
static getDefaultOption ($opt)
 Get a given default option value.
static getDefaultOptions ()
 Combine the language default options with any site-specific options and add the default language variants.
static getGroupMember ($group, $username= '#')
 Get the localized descriptive name for a member of a group, if it exists.
static getGroupName ($group)
 Get the localized descriptive name for a group, if it exists.
static getGroupPage ($group)
 Get the title of a page describing a particular group.
static getGroupPermissions ($groups)
 Get the permissions associated with a given list of groups.
static getGroupsWithPermission ($role)
 Get all the groups who have a given permission.
static getImplicitGroups ()
 Get a list of implicit groups.
static getRightDescription ($right)
 Get the description of a given right.
static groupHasPermission ($group, $role)
 Check, if the given group has the given permission.
static idFromName ($name)
 Get database id given a user name.
static isCreatableName ($name)
 Usernames which fail to pass this function will be blocked from new account registrations, but may be used internally either by batch processes or by user accounts which have already been created.
static isEveryoneAllowed ($right)
 Check if all users have the given permission.
static isIP ($name)
 Does the string match an anonymous IPv4 address?
static isLocallyBlockedProxy ($ip)
 Check if an IP address is in the local proxy list.
static isUsableName ($name)
 Usernames which fail to pass this function will be blocked from user login and new account registrations, but may be used internally by batch processes.
static isValidEmailAddr ($addr)
 Does a string look like an e-mail address?
static isValidUserName ($name)
 Is the input a valid username?
static listOptionKinds ()
 Return a list of the types of user options currently returned by User::getOptionKinds().
static makeGroupLinkHTML ($group, $text= '')
 Create a link to the group in HTML, if available; else return the group name.
static makeGroupLinkWiki ($group, $text= '')
 Create a link to the group in Wikitext, if available; else return the group name.
static newFatalPermissionDeniedStatus ($permission)
 Factory function for fatal permission-denied errors.
static oldCrypt ($password, $userId)
 Make an old-style password hash.
static passwordChangeInputAttribs ()
 Provide an array of HTML5 attributes to put on an input element intended for the user to enter a new password.
static randomPassword ()
 Return a random password.
static resetIdByNameCache ()
 Reset the cache used in idFromName().
static selectFields ()
 Return the list of user fields that should be selected to create a new user object.
static whoIs ($id)
 Get the username corresponding to a given user ID.
static whoIsReal ($id)
 Get the real name of a user given their user ID.
newFrom*() static factory methods
static newFromName ($name, $validate= 'valid')
 Static factory method for creation from username.
static newFromId ($id)
 Static factory method for creation from a given user ID.
static newFromConfirmationCode ($code)
 Factory method to fetch whichever user has a given email confirmation code.
static newFromSession (WebRequest $request=null)
 Create a new user object using data from session or cookies.
static newFromRow ($row, $data=null)
 Create a new user object from a user row.

Public Attributes

bool $mAllowUsertalk
Block $mBlock
 $mBlockedby
 $mBlockedGlobally
 $mBlockreason
 $mDatePreference
 $mEffectiveGroups
 $mFormerGroups
 $mFrom
 String Initialization data source if mLoadedItems!==true.
 $mHash
 $mHideName
 $mImplicitGroups
 $mLocked
 $mNewtalk
 Lazy-initialized variables, invalidated with clearInstanceCache.
 $mOptions
 $mRights
const EDIT_TOKEN_SUFFIX = EDIT_TOKEN_SUFFIX
const MAX_WATCHED_ITEMS_CACHE = 100
 Maximum items in $mWatchedItems.
const MW_USER_VERSION = MW_USER_VERSION
const USER_TOKEN_LENGTH = USER_TOKEN_LENGTH
 Global constants made accessible as class constants so that autoloader magic can be used.
Cache variables
 $mId
 $mName
 $mRealName
 $mPassword
 $mNewpassword
 $mNewpassTime
 $mEmail
 $mTouched
 $mToken
 $mEmailAuthenticated
 $mEmailToken
 $mEmailTokenExpires
 $mRegistration
 $mEditCount
 $mGroups
 $mOptionOverrides

Static Public Attributes

static $idCacheByName = array()
static $mAllRights = false
 String Cached results of getAllRights()
static $mCacheVars
 Array of Strings List of member variables which are saved to the shared cache (memcached).
static $mCoreRights
 Array of Strings Core rights.

Protected Member Functions

 checkNewtalk ($field, $id, $fromMaster=false)
 Internal uncached check for new messages.
 clearCookie ($name, $secure=null, $params=array())
 Clear a cookie on the user's client.
 compareSecrets ($answer, $test)
 A comparison of two strings, not vulnerable to timing attacks.
 confirmationToken (&$expiration)
 Generate, store, and return a new e-mail confirmation code.
 confirmationTokenUrl ($token)
 Return a URL the user can use to confirm their email address.
 deleteNewtalk ($field, $id)
 Clear the new messages flag for the given user.
 getTokenUrl ($page, $token)
 Internal function to format the e-mail validation/invalidation URLs.
 initEditCount ($add=0)
 Initialize user_editcount from data out of the revision table.
 invalidationTokenUrl ($token)
 Return a URL the user can use to invalidate their email address.
 loadFromUserObject ($user)
 Load the data for this user object from another user object.
 loadOptions ($data=null)
 Load the user options either from cache, the database or an array.
 saveOptions ()
 setCookie ($name, $value, $exp=0, $secure=null, $params=array())
 Set a cookie on the user's client.
 setItemLoaded ($item)
 Set that an item has been loaded.
 spreadBlock ()
 If this (non-anonymous) user is blocked, block the IP address they've successfully logged in from.
 updateNewtalk ($field, $id, $curRev=null)
 Add or update the new messages flag.

Private Member Functions

 clearSharedCache ()
 Clear user data from memcached.
 decodeOptions ($str)
 Set this user's options from an encoded string.
 getBlockedStatus ($bFromSlave=true)
 Get blocking information.
 loadFromSession ()
 Load user data from the session or login cookie.
 loadGroups ()
 Load the groups from the database if they aren't already loaded.

Static Private Member Functions

static newTouchedTimestamp ()
 Generate a current or new-future timestamp to be stored in the user_touched field when we update things.

Private Attributes

Block $mBlockedFromCreateAccount = false
WebRequest $mRequest
Array $mWatchedItems = array()
 $mOptionsLoaded
 Bool Whether the cache variables have been loaded.
 $mLoadedItems = array()
 Array with already loaded items or true if all items have been loaded.

Detailed Description

The User object encapsulates all of the user-specific settings (user_id, name, rights, password, email address, options, last login time).

Client classes use the getXXX() functions to access these fields. These functions do all the work of determining whether the user is logged in, whether the requested option can be satisfied from cookies or whether a database query is needed. Most of the settings needed for rendering normal pages are set in the cookie to minimize use of the database.

Definition at line 59 of file User.php.


Constructor & Destructor Documentation

Lightweight constructor for an anonymous user.

Use the User::newFrom* factory functions for other kinds of users.

See also:
newFromName()
newFromId()
newFromConfirmationCode()
newFromSession()
newFromRow()

Definition at line 252 of file User.php.


Member Function Documentation

Returns:
string

Definition at line 259 of file User.php.

Add the user to the group if he/she meets given criteria.

Contrary to autopromotion by $wgAutopromote, the group will be possible to remove manually via Special:UserRights. In such case it will not be re-added automatically. The user will also not lose the group if they no longer meet the criteria.

Parameters:
string$eventkey in $wgAutopromoteOnce (each one has groups/criteria)
Returns:
array Array of groups the user has been promoted to.
See also:
$wgAutopromoteOnce

Definition at line 1179 of file User.php.

User::addGroup ( group)

Add the user to the given group.

This takes immediate effect.

Parameters:
string$groupName of the group to add

Definition at line 2796 of file User.php.

User::addNewUserLogEntry ( action = false,
reason = '' 
)

Add a newuser log entry for this user.

Before 1.19 the return value was always true.

Parameters:
string | bool$actionaccount creation type.
  • String, one of the following values:
    • 'create' for an anonymous user creating an account for himself. This will force the action's performer to be the created user itself, no matter the value of $wgUser
    • 'create2' for a logged in user creating an account for someone else
    • 'byemail' when the created user will receive its password by e-mail
    • 'autocreate' when the user is automatically created (such as by CentralAuth).
  • Boolean means whether the account was created by e-mail (deprecated):
    • true will be converted to 'byemail'
    • false will be converted to 'create' if this object is the same as $wgUser and to 'create2' otherwise
string$reasonuser supplied reason
Returns:
int|bool True if not $wgNewUserLog; otherwise ID of log item or 0 on failure

Definition at line 4549 of file User.php.

Add an autocreate newuser log entry for this user Used by things like CentralAuth and perhaps other authplugins.

Consider calling addNewUserLogEntry() directly instead.

Returns:
bool

Definition at line 4594 of file User.php.

Add this existing user object to the database.

If the user already exists, a fatal status object is returned, and the user object is initialised with the data from the database.

Previously, this function generated a DB error due to a key conflict if the user already existed. Many extension callers use this function in code along the lines of:

$user = User::newFromName( $name ); if ( !$user->isLoggedIn() ) { $user->addToDatabase(); } // do something with $user...

However, this was vulnerable to a race condition (bug 16020). By initialising the user object if the user exists, we aim to support this calling sequence as far as possible.

Note that if the user exists, this function will acquire a write lock, so it is still advisable to make the call conditional on isLoggedIn(), and to commit the transaction after calling.

Exceptions:
MWException
Returns:
Status

Definition at line 3422 of file User.php.

User::addWatch ( title,
checkRights = WatchedItem::CHECK_USER_RIGHTS 
)

Watch an article.

Since:
1.22 $checkRights parameter added
Parameters:
$titleTitle of the article to look at
$checkRightsint Whether to check 'viewmywatchlist'/'editmywatchlist' rights. Pass WatchedItem::CHECK_USER_RIGHTS or WatchedItem::IGNORE_USER_RIGHTS.

Definition at line 3016 of file User.php.

Referenced by WatchAction\doWatch().

If user is blocked, return the name of the user who placed the block.

Returns:
string Name of blocker

Definition at line 1666 of file User.php.

References getBlockedStatus().

Referenced by SpecialBlock\checkUnblockSelf().

If user is blocked, return the specified reason for the block.

Returns:
string Blocking reason

Definition at line 1675 of file User.php.

References getBlockedStatus().

Is this user allowed to receive e-mails within limits of current site configuration?

Returns:
bool

Definition at line 3962 of file User.php.

Is this user allowed to send e-mails within limits of current site configuration?

Returns:
bool

Definition at line 3947 of file User.php.

static User::changeableByGroup ( group) [static]

Returns an array of the groups that a particular group can add/remove.

Parameters:
string$groupthe group to check for whether it can add/remove
Returns:
Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ), 'add-self' => array( addablegroups to self), 'remove-self' => array( removable groups from self) )

Definition at line 4279 of file User.php.

Returns an array of groups that this user can add and remove.

Returns:
Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ), 'add-self' => array( addablegroups to self), 'remove-self' => array( removable groups from self) )

Definition at line 4343 of file User.php.

User::checkNewtalk ( field,
id,
fromMaster = false 
) [protected]

Internal uncached check for new messages.

See also:
getNewtalk()
Parameters:
string$field'user_ip' for anonymous users, 'user_id' otherwise
string | int$idUser's IP address for anonymous users, User ID otherwise
bool$fromMastertrue to fetch from the master, false for a slave
Returns:
bool True if the user has new messages

Definition at line 1918 of file User.php.

Referenced by getNewtalk().

User::checkPassword ( password)

Check to see if the given clear-text password is one of the accepted passwords.

Parameters:
string$passworduser password.
Returns:
boolean: True if the given password is correct, otherwise False.

Definition at line 3633 of file User.php.

User::checkTemporaryPassword ( plaintext)

Check if the given clear-text password matches the temporary password sent by e-mail for password reset operations.

Parameters:
$plaintextstring
Returns:
boolean: True if matches, false otherwise

Definition at line 3678 of file User.php.

Resets all of the given user's page-change notification timestamps.

If e-notif e-mails are on, they will receive notification mails on the next change of any watched page.

Note:
If the user doesn't have 'editmywatchlist', this will do nothing.

Definition at line 3090 of file User.php.

User::clearCookie ( name,
secure = null,
params = array() 
) [protected]

Clear a cookie on the user's client.

Parameters:
string$nameName of the cookie to clear
bool$securetrue: Force setting the secure attribute when setting the cookie false: Force NOT setting the secure attribute when setting the cookie null (default): Use the default ($wgCookieSecure) to set the secure attribute
array$paramsArray of options sent passed to WebResponse::setcookie()

Definition at line 3175 of file User.php.

Referenced by doLogout().

User::clearInstanceCache ( reloadFrom = false)

Clear various cached data stored in this object.

The cache of the user table data (i.e. self::$mCacheVars) is not cleared unless $reloadFrom is given.

Parameters:
bool | string$reloadFromReload user and user_groups table data from a given source. May be "name", "id", "defaults", "session", or false for no reload.

Definition at line 1220 of file User.php.

Referenced by doLogout(), and setId().

User::clearNotification ( &$  title)

Clear the user's notification timestamp for the given title.

If e-notif e-mails are on, they will receive notification mails on the next change of the page if it's watched etc.

Note:
If the user doesn't have 'editmywatchlist', this will do nothing.
Parameters:
$titleTitle of the article to look at

Definition at line 3040 of file User.php.

User::clearSharedCache ( ) [private]

Clear user data from memcached.

Use after applying fun updates to the database; caller's responsibility to update user_touched if appropriate.

Called implicitly from invalidateCache() and saveSettings().

Definition at line 2031 of file User.php.

Referenced by saveSettings().

static User::comparePasswords ( hash,
password,
userId = false 
) [static]

Compare a password hash with a plain-text password.

Requires the user ID if there's a chance that the hash is an old-style hash.

Parameters:
string$hashPassword hash
string$passwordPlain-text password to compare
string | bool$userIdUser ID for old-style password salt
Returns:
boolean

Definition at line 4507 of file User.php.

User::compareSecrets ( answer,
test 
) [protected]

A comparison of two strings, not vulnerable to timing attacks.

Parameters:
string$answerthe secret string that you are comparing against.
string$testcompare this string to the $answer.
Returns:
bool True if the strings are the same, false otherwise

Definition at line 1008 of file User.php.

Referenced by loadFromSession().

User::confirmationToken ( &$  expiration) [protected]

Generate, store, and return a new e-mail confirmation code.

A hash (unsalted, since it's used as a key) is stored.

Note:
Call saveSettings() after calling this function to commit this change to the database.
Parameters:
&$expirationAccepts the expiration time
Returns:
string New token

Definition at line 3848 of file User.php.

User::confirmationTokenUrl ( token) [protected]

Return a URL the user can use to confirm their email address.

Parameters:
string$tokenAccepts the email confirmation token
Returns:
string New token URL

Definition at line 3866 of file User.php.

Mark the e-mail address confirmed.

Note:
Call saveSettings() after calling this function to commit the change.
Returns:
bool

Definition at line 3906 of file User.php.

static User::createNew ( name,
params = array() 
) [static]

Add a user to the database, return the user object.

Parameters:
string$nameUsername to add
array$paramsof Strings Non-default parameters to save to the database as user_* fields:
  • password The user's password hash. Password logins will be disabled if this is omitted.
  • newpassword Hash for a temporary password that has been mailed to the user
  • email The user's email address
  • email_authenticated The email authentication timestamp
  • real_name The user's real name
  • options An associative array of non-default options
  • token Random authentication token. Do not set.
  • registration Registration timestamp. Do not set.
Returns:
User object, or null if the username already exists

Definition at line 3359 of file User.php.

Referenced by TestUser\__construct(), and UserWrapper\__construct().

static User::crypt ( password,
salt = false 
) [static]

Make a new-style password hash.

Parameters:
string$passwordPlain-text password
bool | string$saltOptional salt, may be random or the user ID. If unspecified or false, will generate one automatically
Returns:
string Password hash

Definition at line 4479 of file User.php.

User::decodeOptions ( str) [private]

Set this user's options from an encoded string.

Parameters:
string$strEncoded options to import
Deprecated:
in 1.19 due to removal of user_options from the user table

Definition at line 3126 of file User.php.

User::deleteNewtalk ( field,
id 
) [protected]

Clear the new messages flag for the given user.

Parameters:
string$field'user_ip' for anonymous users, 'user_id' otherwise
string | int$idUser's IP address for anonymous users, User ID otherwise
Returns:
bool True if successful, false otherwise

Definition at line 1961 of file User.php.

Clear the user's cookies and session, and reset the instance cache.

See also:
logout()

Definition at line 3266 of file User.php.

References array(), clearCookie(), clearInstanceCache(), getRequest(), and setCookie().

static User::edits ( uid) [static]

Count the number of edits of a user.

Parameters:
int$uidUser ID to check
Returns:
int The user's edit count
Deprecated:
since 1.21 in favour of User::getEditCount

Definition at line 834 of file User.php.

User::editToken ( salt = '',
request = null 
)

Alias for getEditToken.

Deprecated:
since 1.19, use getEditToken instead.
Parameters:
string | array$saltof Strings Optional function-specific data for hashing
$requestWebRequest object to use or null to use $wgRequest
Returns:
string The new edit token

Definition at line 3701 of file User.php.

static User::generateToken ( ) [static]

Generate a looking random token for various uses.

Returns:
string The new random token
Deprecated:
since 1.20: Use MWCryptRand for secure purposes or wfRandomString for pseudo-randomness

Definition at line 3744 of file User.php.

static User::getAllGroups ( ) [static]

Return the set of defined explicit groups.

The implicit groups (by default *, 'user' and 'autoconfirmed') are not included, as they are defined automatically, not in the database.

Returns:
Array of internal group names

Definition at line 4176 of file User.php.

Referenced by UsersPager\__construct(), ApiQueryAllUsers\execute(), UsersPager\getAllGroups(), ApiUserrights\getAllowedParams(), and ApiQueryAllUsers\getAllowedParams().

static User::getAllRights ( ) [static]

Get a list of all available permissions.

Returns:
Array of permission names

Definition at line 4188 of file User.php.

References $mAllRights, $mCoreRights, array(), global, and wfRunHooks().

Referenced by ApiQueryAllUsers\getAllowedParams().

User::getAutomaticGroups ( recache = false)

Get the list of implicit group memberships this user has.

This includes 'user' if logged in, '*' for all accounts, and autopromoted groups

Parameters:
bool$recacheWhether to avoid the cache
Returns:
Array of String internal group names

Definition at line 2715 of file User.php.

User::getBlock ( bFromSlave = true)

Get the block affecting the user, or null if the user is not blocked.

Parameters:
bool$bFromSlaveWhether to check the slave database instead of the master
Returns:
Block|null

Definition at line 1631 of file User.php.

User::getBlockedStatus ( bFromSlave = true) [private]

Get blocking information.

Parameters:
bool$bFromSlaveWhether to check the slave database first. To improve performance, non-critical checks are done against slaves. Check when actually saving should be done against master.

Definition at line 1294 of file User.php.

Referenced by blockedBy(), blockedFor(), getBlockId(), isBlockedFromCreateAccount(), and isBlockedFromEmailuser().

If user is blocked, return the ID for the block.

Returns:
int Block ID

Definition at line 1684 of file User.php.

References false, and getBlockedStatus().

User::getBoolOption ( oname)

Get the user's current setting for a given option, as a boolean value.

Parameters:
string$onameThe option to check
Returns:
bool User's current value for the option
See also:
getOption()

Definition at line 2370 of file User.php.

static User::getCanonicalName ( name,
validate = 'valid' 
) [static]

Given unvalidated user input, return a canonical username, or false if the username is invalid.

Parameters:
string$nameUser input
string | bool$validatetype of validation to use:
  • false No validation
  • 'valid' Valid for batch processes
  • 'usable' Valid for batch processes and login
  • 'creatable' Valid for batch processes, login and account creation
Exceptions:
MWException
Returns:
bool|string

Definition at line 778 of file User.php.

Referenced by RollbackEdits\execute(), UserrightsPage\execute(), ApiQueryUsers\execute(), UserrightsPage\fetchUser(), ApiQueryContributions\prepareUsername(), ApiQueryBlocks\prepareUsername(), and WebInstaller_Name\submit().

Get the user's preferred date format.

Returns:
string User's preferred date format

Definition at line 2610 of file User.php.

References $value, $wgLang, getOption(), and global.

static User::getDefaultOption ( opt) [static]

Get a given default option value.

Parameters:
string$optName of option to retrieve
Returns:
string Default option value

Definition at line 1278 of file User.php.

Referenced by CoreParserFunctions\gender(), GenderCache\getDefault(), and Linker\makeImageLink().

static User::getDefaultOptions ( ) [static]

Combine the language default options with any site-specific options and add the default language variants.

Returns:
Array of String options

Definition at line 1245 of file User.php.

Referenced by userOptions\getDefaultOptionsNames(), Preferences\getPreferences(), userOptions\LISTER(), and userOptions\USAGER().

Get the user's edit count.

Returns:
int, null for anonymous users

Definition at line 2765 of file User.php.

References $count, $dbr, array(), getId(), initEditCount(), wfGetDB(), wfProfileIn(), and wfProfileOut().

Referenced by Autopromote\checkCondition(), and LogFormatter\makeUserLink().

User::getEditToken ( salt = '',
request = null 
)

Initialize (if necessary) and return a session token value which can be used in edit forms to show that the user's login credentials aren't being hijacked with a foreign form submission.

Since:
1.19
Parameters:
string | array$saltof Strings Optional function-specific data for hashing
$requestWebRequest object to use or null to use $wgRequest
Returns:
string The new edit token

Definition at line 3718 of file User.php.

Referenced by WatchAction\getWatchToken().

User::getEffectiveGroups ( recache = false)

Get the list of implicit group memberships this user has.

This includes all explicit groups, plus 'user' if logged in, '*' for all accounts, and autopromoted groups

Parameters:
bool$recacheWhether to avoid the cache
Returns:
Array of String internal group names

Definition at line 2692 of file User.php.

Referenced by getRights().

Get the user's e-mail address.

Returns:
string User's email address

Definition at line 2221 of file User.php.

References array(), load(), and wfRunHooks().

Referenced by Autopromote\checkCondition().

Get the timestamp of the user's e-mail authentication.

Returns:
string TS_MW timestamp

Definition at line 2231 of file User.php.

References array(), load(), and wfRunHooks().

Referenced by Autopromote\checkCondition().

Get the timestamp of the first edit.

Returns:
string|bool Timestamp of first edit, or false for non-existent/anonymous user accounts.

Definition at line 4029 of file User.php.

Referenced by Autopromote\checkCondition().

Returns the groups the user has belonged to.

The user may still belong to the returned groups. Compare with getGroups().

The function will not return groups the user had belonged to before MW 1.17

Returns:
array Names of the groups the user has belonged to.

Definition at line 2746 of file User.php.

Referenced by Autopromote\getAutopromoteOnceGroups().

static User::getGroupMember ( group,
username = '#' 
) [static]

Get the localized descriptive name for a member of a group, if it exists.

Parameters:
string$groupInternal group name
string$usernameUsername for gender (since 1.19)
Returns:
string Localized name for group member

Definition at line 4165 of file User.php.

Referenced by UsersPager\buildGroupLink(), UserrightsPage\buildGroupMemberLink(), RightsLogFormatter\getMessageParameters(), UserrightsPage\groupCheckboxes(), and Preferences\profilePreferences().

static User::getGroupName ( group) [static]

Get the localized descriptive name for a group, if it exists.

Parameters:
string$groupInternal group name
Returns:
string Localized descriptive group name

Definition at line 4153 of file User.php.

Referenced by UserrightsPage\buildGroupLink(), UsersPager\getAllGroups(), and Preferences\profilePreferences().

static User::getGroupPage ( group) [static]

Get the title of a page describing a particular group.

Parameters:
string$groupInternal group name
Returns:
Title|bool Title of the page if it exists, false otherwise

Definition at line 4218 of file User.php.

static User::getGroupPermissions ( groups) [static]

Get the permissions associated with a given list of groups.

Parameters:
array$groupsof Strings List of internal group names
Returns:
Array of Strings List of permission key names for given groups combined

Definition at line 4051 of file User.php.

Referenced by Autopromote\checkCondition(), ApiQueryAllUsers\execute(), getRights(), and wfStreamThumb().

Get the list of explicit group memberships this user has.

The implicit * and user groups are not included.

Returns:
Array of String internal group names

Definition at line 2679 of file User.php.

Referenced by Autopromote\checkCondition(), and Autopromote\getAutopromoteOnceGroups().

static User::getGroupsWithPermission ( role) [static]

Get all the groups who have a given permission.

Parameters:
string$roleRole to check
Returns:
Array of Strings List of internal group names with the given permission

Definition at line 4078 of file User.php.

Referenced by PermissionsError\__construct(), ApiQueryAllUsers\execute(), NewFilesPager\getQueryInfo(), ContribsPager\getUserCond(), Title\missingPermissionError(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), and ApiQueryAllImages\run().

Get the user's ID.

Returns:
int The user's ID; 0 if the user is anonymous or nonexistent

Definition at line 1752 of file User.php.

References isIP(), isItemLoaded(), and load().

Referenced by SpecialBlock\checkUnblockSelf(), ApiUnblock\execute(), ApiBlock\execute(), getEditCount(), incEditCount(), and LogFormatter\makeUserLink().

static User::getImplicitGroups ( ) [static]

Get a list of implicit groups.

Returns:
Array of Strings Array of internal group names

Definition at line 4205 of file User.php.

References array(), global, and wfRunHooks().

Referenced by UsersPager\getGroups().

User::getIntOption ( oname,
defaultOverride = 0 
)

Get the user's current setting for a given option, as an integer value.

Parameters:
string$onameThe option to check
int$defaultOverrideA default value returned if the option does not exist
Returns:
int User's current value for the option
See also:
getOption()

Definition at line 2382 of file User.php.

Get the user name, or the IP of an anonymous user.

Returns:
string User's name or IP address

Definition at line 1776 of file User.php.

References getRequest(), isItemLoaded(), load(), and IP\sanitizeIP().

Referenced by SpecialBlock\checkUnblockSelf(), ApiUnblock\execute(), getNewtalk(), getTitleKey(), idForName(), CreditsAction\link(), LogFormatter\makeUserLink(), RdfMetaData\person(), and CreditsAction\userLink().

Return the data needed to construct links for new talk page message alerts.

If there are new messages, this will return an associative array with the following data: wiki: The database name of the wiki link: Root-relative link to the user's talk page rev: The last talk page revision that the user has seen or null. This is useful for building diff links. If there are no new messages, it returns an empty array.

Note:
This function was designed to accomodate multiple talk pages, but currently only returns a single link and revision.
Returns:
Array

Definition at line 1868 of file User.php.

Get the revision ID for the last talk page revision viewed by the talk page owner.

Returns:
int|null Revision ID or null

Definition at line 1891 of file User.php.

Check if the user has new messages.

Returns:
bool True if the user has new messages

Definition at line 1820 of file User.php.

References $key, $wgMemc, checkNewtalk(), getName(), global, load(), page, and wfMemcKey().

User::getOption ( oname,
defaultOverride = null,
ignoreHidden = false 
)

Get the user's current setting for a given option.

Parameters:
string$onameThe option to check
string$defaultOverrideA default value returned if the option does not exist
bool$ignoreHiddenWhether to ignore the effects of $wgHiddenPrefs
Returns:
string User's current value for the option
See also:
getBoolOption()
getIntOption()

Reimplemented in PPFuzzUser.

Definition at line 2318 of file User.php.

Referenced by getDatePreference().

User::getOptionKinds ( IContextSource context,
options = null 
)

Return an associative array mapping preferences keys to the kind of a preference they're used for.

Different kinds are handled differently when setting or reading preferences.

See User::listOptionKinds for the list of valid option types that can be provided.

See also:
User::listOptionKinds
Parameters:
$contextIContextSource
array$optionsassoc. array with options keys to check as keys. Defaults to $this->mOptions.
Returns:
array the key => kind mapping data

Definition at line 2492 of file User.php.

Get all user's options.

Returns:
array

Definition at line 2343 of file User.php.

Generate a string which will be different for any combination of user options which would produce different parser output.

This will be used as part of the hash key for the parser cache, so users with the same options can share the same cached data safely.

Extensions which require it should install 'PageRenderingHash' hook, which will give them a chance to modify this key based on their own settings.

Deprecated:
since 1.17 use the ParserOptions object to get the relevant options
Returns:
string Page rendering hash

Definition at line 3526 of file User.php.

User::getPasswordValidity ( password)

Given unvalidated password input, return error message on failure.

Parameters:
string$passwordDesired password
Returns:
mixed: true on success, string or array of error message on failure

Definition at line 698 of file User.php.

Get the user's real name.

Returns:
string User's real name

Definition at line 2291 of file User.php.

References isItemLoaded(), and load().

Referenced by CreditsAction\link(), RdfMetaData\person(), and CreditsAction\userLink().

Get the timestamp of account creation.

Returns:
string|bool|null Timestamp of account creation, false for non-existent/anonymous user accounts, or null if existing account but information is not in database.

Definition at line 4015 of file User.php.

Referenced by Autopromote\checkCondition().

Get the WebRequest object to use with this object.

Returns:
WebRequest

Definition at line 2953 of file User.php.

Referenced by Autopromote\checkCondition(), doLogout(), getName(), isBlockedFromCreateAccount(), and loadFromSession().

static User::getRightDescription ( right) [static]

Get the description of a given right.

Parameters:
string$rightRight to query
Returns:
string Localized description of the right

Definition at line 4449 of file User.php.

Referenced by SpecialListGroupRights\formatPermissions().

Get the permissions this user has.

Returns:
Array of String permission names

Definition at line 2664 of file User.php.

References array(), getEffectiveGroups(), getGroupPermissions(), and wfRunHooks().

Get the current skin, loading it if required.

Returns:
Skin The current skin
Todo:
FIXME: Need to check the old failback system [AV]
Deprecated:
since 1.18 Use ->getSkin() in the most relevant outputting context you have

Definition at line 2968 of file User.php.

Get the user preferred stub threshold.

Returns:
int

Definition at line 2649 of file User.php.

Get this user's talk page title.

Returns:
Title: User's talk page title

Definition at line 3614 of file User.php.

Get the user's name escaped by underscores.

Returns:
string Username escaped by underscores.

Definition at line 1812 of file User.php.

References getName().

User::getToken ( forceCreation = true)

Get the user's current token.

Parameters:
bool$forceCreationForce the generation of a new token if the user doesn't have one (default=true for backwards compatibility)
Returns:
string Token

Definition at line 2165 of file User.php.

Get a token stored in the preferences (like the watchlist one), resetting it if it's empty (and saving changes).

Parameters:
string$onameThe option name to retrieve the token from
Returns:
string|bool User's current value for the option, or false if this option is disabled.
See also:
resetTokenFromOption()
getOption()

Definition at line 2416 of file User.php.

User::getTokenUrl ( page,
token 
) [protected]

Internal function to format the e-mail validation/invalidation URLs.

This uses a quickie hack to use the hardcoded English names of the Special: pages, for ASCII safety.

Note:
Since these URLs get dropped directly into emails, using the short English names avoids insanely long URL-encoded links, which also sometimes can get corrupted in some browsers/mailers (bug 6957 with Gmail and Internet Explorer).
Parameters:
string$pageSpecial page
string$tokenToken
Returns:
string Formatted URL

Definition at line 3893 of file User.php.

Get the user touched timestamp.

Returns:
string timestamp

Definition at line 2087 of file User.php.

References load().

Get this user's personal page title.

Returns:
Title: User's personal page title

Definition at line 3605 of file User.php.

Referenced by CreditsAction\link(), RdfMetaData\person(), and saveSettings().

User::getWatchedItem ( title,
checkRights = WatchedItem::CHECK_USER_RIGHTS 
)

Get a WatchedItem for this user and $title.

Since:
1.22 $checkRights parameter added
Parameters:
$titleTitle
$checkRightsint Whether to check 'viewmywatchlist'/'editmywatchlist' rights. Pass WatchedItem::CHECK_USER_RIGHTS or WatchedItem::IGNORE_USER_RIGHTS.
Returns:
WatchedItem

Definition at line 2982 of file User.php.

static User::groupHasPermission ( group,
role 
) [static]

Check, if the given group has the given permission.

If you're wanting to check whether all users have a permission, use User::isEveryoneAllowed() instead. That properly checks if it's revoked from anyone.

Since:
1.21
Parameters:
string$groupGroup to check
string$roleRole to check
Returns:
bool

Definition at line 4101 of file User.php.

Referenced by Title\checkQuickPermissions(), and SpecialNewpages\filterLinks().

If only this user's username is known, and it exists, return the user ID.

Returns:
int

Definition at line 3329 of file User.php.

References $dbr, array(), getName(), and wfGetDB().

static User::idFromName ( name) [static]

Get database id given a user name.

Parameters:
string$nameUsername
Returns:
int|null The corresponding user's ID, or null if user is nonexistent

Definition at line 499 of file User.php.

Referenced by ApiQueryLogEvents\execute(), UsersPager\getQueryInfo(), ContribsPager\getUserCond(), LogPager\limitPerformer(), SpecialUnblock\processUnblock(), and BlockTest\testBug29116LoadWithEmptyIp().

Increment the user's edit-count field.

Will have no effect for anonymous users.

Definition at line 4383 of file User.php.

References $dbr, array(), getId(), initEditCount(), invalidateCache(), isAnon(), and wfGetDB().

User::inDnsBlacklist ( ip,
bases 
)

Whether the given IP is in a given DNS blacklist.

Parameters:
string$ipIP to check
string | array$basesof Strings: URL of the DNS blacklist
Returns:
bool True if blacklisted.

Definition at line 1409 of file User.php.

User::initEditCount ( add = 0) [protected]

Initialize user_editcount from data out of the revision table.

Parameters:
$addInteger Edits to add to the count from the revision table
Returns:
integer Number of edits

Definition at line 4420 of file User.php.

Referenced by getEditCount(), and incEditCount().

Immediately touch the user data cache for this account.

Updates user_touched field, and removes account data from memcached for reload on the next hit.

Definition at line 2044 of file User.php.

Referenced by incEditCount().

Invalidate the user's e-mail confirmation, and unauthenticate the e-mail address if it was already confirmed.

Note:
Call saveSettings() after calling this function to commit the change.
Returns:
bool Returns true

Definition at line 3923 of file User.php.

Referenced by setEmail().

User::invalidationTokenUrl ( token) [protected]

Return a URL the user can use to invalidate their email address.

Parameters:
string$tokenAccepts the email confirmation token
Returns:
string New token URL

Definition at line 3875 of file User.php.

User::isAllowed ( action = '')

Internal mechanics of testing a permission.

Parameters:
string$action
Returns:
bool

Definition at line 2911 of file User.php.

Referenced by SpecialBlock\checkUnblockSelf(), WatchAction\doUnwatch(), WatchAction\doWatch(), isAllowedToCreateAccount(), isBlockedFromCreateAccount(), and Title\isNamespaceProtected().

Definition at line 2896 of file User.php.

Check if user is allowed to access a feature / make an action.

Definition at line 2881 of file User.php.

Referenced by useNPPatrol(), and useRCPatrol().

Get whether the user is allowed to create an account.

Returns:
bool

Definition at line 3596 of file User.php.

References isAllowed(), and isBlockedFromCreateAccount().

Get whether the user is anonymous.

Returns:
bool

Definition at line 2869 of file User.php.

References isLoggedIn().

Referenced by WatchAction\checkCanExecute(), incEditCount(), CreditsAction\link(), RdfMetaData\person(), and CreditsAction\userLink().

User::isBlocked ( bFromSlave = true)

Check if user is blocked.

Parameters:
bool$bFromSlaveWhether to check the slave database instead of the master
Returns:
bool True if blocked, false otherwise

Definition at line 1621 of file User.php.

Referenced by Autopromote\checkCondition(), and SpecialBlock\checkUnblockSelf().

User::isBlockedFrom ( title,
bFromSlave = false 
)

Check if user is blocked from editing a particular article.

Parameters:
Title$titleTitle to check
bool$bFromSlavewhether to check the slave database instead of the master
Returns:
bool

Definition at line 1643 of file User.php.

Get whether the user is explicitly blocked from account creation.

Returns:
bool|Block

Definition at line 3566 of file User.php.

References getBlockedStatus(), getRequest(), isAllowed(), and Block\newFromTarget().

Referenced by isAllowedToCreateAccount().

Get whether the user is blocked from using Special:Emailuser.

Returns:
bool

Definition at line 3587 of file User.php.

References getBlockedStatus().

User::isBlockedGlobally ( ip = '')

Check if user is blocked on all wikis.

Do not use for actual edit permission checks! This is intended for quick UI checks.

Parameters:
string$ipIP address, uses current client if none given
Returns:
bool True if blocked, false otherwise

Definition at line 1697 of file User.php.

static User::isCreatableName ( name) [static]

Usernames which fail to pass this function will be blocked from new account registrations, but may be used internally either by batch processes or by user accounts which have already been created.

Additional blacklisting may be added here rather than in isValidUserName() to avoid disrupting existing accounts.

Parameters:
string$nameto match
Returns:
bool

Definition at line 657 of file User.php.

User::isDnsBlacklisted ( ip,
checkWhitelist = false 
)

Whether the given IP is in a DNS blacklist.

Parameters:
string$ipIP to check
bool$checkWhitelistwhether to check the whitelist first
Returns:
bool True if blacklisted.

Definition at line 1386 of file User.php.

Check whether there is an outstanding request for e-mail confirmation.

Returns:
bool

Definition at line 4000 of file User.php.

References global, isEmailConfirmed(), and wfTimestamp().

Is this user's e-mail address valid-looking and confirmed within limits of the current site configuration?

Note:
If $wgEmailAuthentication is on, this may require the user to have confirmed their address by returning a code or using a password sent to the address from the wiki.
Returns:
bool

Definition at line 3976 of file User.php.

Referenced by isEmailConfirmationPending().

static User::isEveryoneAllowed ( right) [static]

Check if all users have the given permission.

Since:
1.22
Parameters:
string$rightRight to check
Returns:
bool

Definition at line 4114 of file User.php.

Referenced by Title\checkReadPermissions(), and RawAction\onView().

Check if user account is hidden.

Returns:
bool True if hidden, false otherwise

Definition at line 1734 of file User.php.

static User::isIP ( name) [static]

Does the string match an anonymous IPv4 address?

This function exists for username validation, in order to reject usernames which are similar in form to IP addresses. Strings such as 300.300.300.300 will return true because it looks like an IP address, despite not being strictly valid.

We match "\d{1,3}\.\d{1,3}\.\d{1,3}\.xxx" as an anonymous IP address because the usemod software would "cloak" anonymous IP addresses like this, if we allowed accounts like this to be created new users could get the old edits of these anonymous users.

Parameters:
string$nameName to match
Returns:
bool

Definition at line 551 of file User.php.

Referenced by RollbackEdits\execute(), getId(), Skin\getRelevantUser(), ReassignEdits\initialiseUser(), ApiQueryContributions\prepareUsername(), and ApiQueryBlocks\prepareUsername().

User::isItemLoaded ( item,
all = 'all' 
)

Return whether an item has been loaded.

Parameters:
string$itemitem to check. Current possibilities:
  • id
  • name
  • realname
string$all'all' to check if the whole object has been loaded or any other string to check if only the item is available (e.g. for optimisation)
Returns:
boolean

Definition at line 908 of file User.php.

Referenced by getId(), getName(), and getRealName().

static User::isLocallyBlockedProxy ( ip) [static]

Check if an IP address is in the local proxy list.

Parameters:
$ipstring
Returns:
bool

Definition at line 1456 of file User.php.

Check if user account is locked.

Returns:
bool True if locked, false otherwise

Definition at line 1718 of file User.php.

Get whether the user is logged in.

Returns:
bool

Definition at line 2861 of file User.php.

Referenced by WatchAction\doWatchOrUnwatch(), and isAnon().

Determine whether the user is a newbie.

Newbies are either anonymous IPs, or the most recently created accounts.

Returns:
bool

Definition at line 3624 of file User.php.

Has password reminder email been sent within the last $wgPasswordReminderResendTime hours?

Returns:
bool

Definition at line 2207 of file User.php.

Is this user subject to rate limiting?

Returns:
bool True if rate limited

Definition at line 1488 of file User.php.

static User::isUsableName ( name) [static]

Usernames which fail to pass this function will be blocked from user login and new account registrations, but may be used internally by batch processes.

If an account already exists in this form, login will be blocked by a failure to pass this function.

Parameters:
string$nameName to match
Returns:
bool

Definition at line 620 of file User.php.

Referenced by ApiBlock\execute().

static User::isValidEmailAddr ( addr) [static]

Does a string look like an e-mail address?

This validates an email address using an HTML5 specification found at: http://www.whatwg.org/html/states-of-the-type-attribute.html#valid-e-mail-address Which as of 2011-01-24 says:

A valid e-mail address is a string that matches the ABNF production 1*( atext / "." ) "@" ldh-str *( "." ldh-str ) where atext is defined in RFC 5322 section 3.2.3, and ldh-str is defined in RFC 1034 section 3.5.

This function is an implementation of the specification as requested in bug 22449.

Client-side forms will use the same standard validation rules via JS or HTML 5 validation; additional restrictions can be enforced server-side by extensions via the 'isValidEmailAddr' hook.

Note that this validation doesn't 100% match RFC 2822, but is believed to be liberal enough for wide use. Some invalid addresses will still pass validation here.

Parameters:
string$addrE-mail address
Returns:
bool
Deprecated:
since 1.18 call Sanitizer::isValidEmail() directly

Definition at line 760 of file User.php.

User::isValidPassword ( password)

Is the input a valid password for this user?

Parameters:
string$passwordDesired password
Returns:
bool

Definition at line 687 of file User.php.

static User::isValidUserName ( name) [static]

Is the input a valid username?

Checks if the input is a valid username, we don't want an empty string, an IP address, anything that contains slashes (would mess up subpages), is longer than the maximum allowed username size or doesn't begin with a capital letter.

Parameters:
string$nameName to match
Returns:
bool

Definition at line 566 of file User.php.

Referenced by GenderCache\doQuery(), and CheckUsernames\execute().

User::isWatched ( title,
checkRights = WatchedItem::CHECK_USER_RIGHTS 
)

Check the watched status of an article.

Since:
1.22 $checkRights parameter added
Parameters:
$titleTitle of the article to look at
$checkRightsint Whether to check 'viewmywatchlist'/'editmywatchlist' rights. Pass WatchedItem::CHECK_USER_RIGHTS or WatchedItem::IGNORE_USER_RIGHTS.
Returns:
bool

Definition at line 3005 of file User.php.

Referenced by WatchAction\doWatchOrUnwatch().

static User::listOptionKinds ( ) [static]

Return a list of the types of user options currently returned by User::getOptionKinds().

Currently, the option kinds are:

  • 'registered' - preferences which are registered in core MediaWiki or by extensions using the UserGetDefaultOptions hook.
  • 'registered-multiselect' - as above, using the 'multiselect' type.
  • 'registered-checkmatrix' - as above, using the 'checkmatrix' type.
  • 'userjs' - preferences with names starting with 'userjs-', intended to be used by user scripts.
  • 'unused' - preferences about which MediaWiki doesn't know anything. These are usually legacy options, removed in newer versions.

The API (and possibly others) use this function to determine the possible option types for validation purposes, so make sure to update this when a new option kind is added.

See also:
User::getOptionKinds
Returns:
array Option kinds

Definition at line 2471 of file User.php.

Referenced by ApiOptions\getAllowedParams().

Load the user table data for this object from the source given by mFrom.

Reimplemented in PPFuzzUser.

Definition at line 266 of file User.php.

Referenced by getEmail(), getEmailAuthenticationTimestamp(), getId(), getName(), getNewtalk(), getRealName(), getTouched(), saveSettings(), setEmail(), setEmailAuthenticationTimestamp(), and setRealName().

User::loadDefaults ( name = false)

Set cached properties to default.

Note:
This no longer clears uncached lazy-initialised properties; the constructor does that instead.
Parameters:
$namestring|bool

Definition at line 865 of file User.php.

Referenced by PPFuzzUser\load(), and loadFromId().

Load user and user_group data from the database.

$this->mId must be set, this is how the user is identified.

Returns:
bool True if the user exists, false if the user is anonymous

Definition at line 1027 of file User.php.

Referenced by loadFromId().

Load user table data, given mId has already been set.

Returns:
bool false if the ID does not exist, true otherwise

Definition at line 309 of file User.php.

References $key, $name, $wgMemc, as, global, loadDefaults(), loadFromDatabase(), saveToCache(), wfDebug(), and wfMemcKey().

User::loadFromRow ( row,
data = null 
)

Initialize this object from a row from the user table.

Parameters:
array$rowRow from the user table to load.
array$dataFurther user data to load into the object

user_groups Array with groups out of the user_groups table user_properties Array with properties out of the user_properties table

Definition at line 1065 of file User.php.

User::loadFromSession ( ) [private]

Load user data from the session or login cookie.

Returns:
bool True if the user is logged in, false otherwise.

Definition at line 928 of file User.php.

References $result, array(), compareSecrets(), getRequest(), global, loadFromUserObject(), newFromId(), wfDebug(), wfDebugLog(), and wfRunHooks().

User::loadFromUserObject ( user) [protected]

Load the data for this user object from another user object.

Parameters:
$userUser

Definition at line 1139 of file User.php.

Referenced by loadFromSession().

User::loadGroups ( ) [private]

Load the groups from the database if they aren't already loaded.

Definition at line 1151 of file User.php.

User::loadOptions ( data = null) [protected]

Load the user options either from cache, the database or an array.

Parameters:
array$dataRows for the current user out of the user_properties table

Definition at line 4605 of file User.php.

Log this user out.

Definition at line 3256 of file User.php.

static User::makeGroupLinkHTML ( group,
text = '' 
) [static]

Create a link to the group in HTML, if available; else return the group name.

Parameters:
string$groupInternal name of the group
string$textThe text of the link
Returns:
string HTML link to the group

Definition at line 4237 of file User.php.

Referenced by Preferences\profilePreferences().

static User::makeGroupLinkWiki ( group,
text = '' 
) [static]

Create a link to the group in Wikitext, if available; else return the group name.

Parameters:
string$groupInternal name of the group
string$textThe text of the link
Returns:
string Wikilink to the group

Definition at line 4257 of file User.php.

User::matchEditToken ( val,
salt = '',
request = null 
)

Check given value against the token value stored in the session.

A match should confirm that the form was submitted from the user's own login session, not a form submission from a third-party site.

Parameters:
string$valInput value to compare
string$saltOptional function-specific data for hashing
WebRequest$requestObject to use or null to use $wgRequest
Returns:
boolean: Whether the token matches

Definition at line 3759 of file User.php.

User::matchEditTokenNoSuffix ( val,
salt = '',
request = null 
)

Check given value against the token value stored in the session, ignoring the suffix.

Parameters:
string$valInput value to compare
string$saltOptional function-specific data for hashing
WebRequest$requestobject to use or null to use $wgRequest
Returns:
boolean: Whether the token matches

Definition at line 3776 of file User.php.

static User::newFatalPermissionDeniedStatus ( permission) [static]

Factory function for fatal permission-denied errors.

Since:
1.22
Parameters:
string$permissionUser right required
Returns:
Status

Definition at line 4799 of file User.php.

Referenced by WatchAction\doUnwatch(), and WatchAction\doWatch().

static User::newFromConfirmationCode ( code) [static]

Factory method to fetch whichever user has a given email confirmation code.

This code is generated when an account is created or its e-mail address has changed.

If the code is invalid or has expired, returns NULL.

Parameters:
string$codeConfirmation code
Returns:
User|null

Definition at line 426 of file User.php.

Referenced by EmailConfirmation\attemptConfirm(), and EmailInvalidation\attemptInvalidate().

static User::newFromName ( name,
validate = 'valid' 
) [static]

Static factory method for creation from username.

This is slightly less efficient than newFromId(), so use newFromId() if you have both an ID and a name handy.

Parameters:
string$nameUsername, validated by Title::newFromText()
string | bool$validateValidate username. Takes the same parameters as User::getCanonicalName(), except that true is accepted as an alias for 'valid', for BC.
Returns:
User|bool User object, or false if the username is invalid (e.g. if it contains illegal characters or is an IP address). If the username is not present in the database, the result will be a user object with a name, zero user ID and default settings.

Definition at line 385 of file User.php.

Referenced by RecentChangeTest\__construct(), TestUser\__construct(), UserWrapper\__construct(), DeletedContributionsPage\__construct(), GenderCacheTest\addDBData(), ApiBlockTest\addDBData(), BlockTest\addDBData(), BackupDumperLoggerTest\addDBData(), BlockTest\addXffBlocks(), EditPageTest\assertEdit(), SpecialChangePassword\attemptReset(), SpecialBlock\checkUnblockSelf(), Undelete\execute(), SpecialContributions\execute(), DeleteDefaultMessages\execute(), CleanupSpam\execute(), ApiBlock\execute(), ImportSiteScripts\execute(), Protect\execute(), RollbackEdits\execute(), ChangePassword\execute(), EditCLI\execute(), CapsCleanup\execute(), SpecialLog\execute(), CreateAndPromote\execute(), DeleteBatch\execute(), TableCleanup\execute(), MoveBatch\execute(), DeleteEqualMessages\execute(), UserrightsPage\fetchUser(), CoreParserFunctions\gender(), CreditsAction\getAuthor(), NewUsersLogFormatter\getMessageParameters(), ResourceLoaderUserGroupsModule\getPages(), DatabaseLogEntry\getPerformer(), RCDatabaseLogEntry\getPerformer(), Skin\getRelevantUser(), DoubleRedirectJob\getUser(), ApiBase\getWatchlistUser(), ReassignEdits\initialiseUser(), SearchEngineTest\insertPage(), Block\parseTarget(), EnotifNotifyJob\run(), SpecialLog\show(), WebInstaller_Name\submit(), BlockTest\testBlockedUserCanNotCreateAccount(), BlockTest\testCrappyCrossWikiBlocks(), RequestContextTest\testImportScopedSession(), ApiBlockTest\testMakeNormalBlock(), and GenderCacheTest\testUserObjects().

static User::newFromRow ( row,
data = null 
) [static]

Create a new user object from a user row.

The row should have the following fields from the user table in it:

  • either user_name or user_id to load further data if needed (or both)
  • user_real_name
  • all other fields (email, password, etc.) It is useless to provide the remaining fields if either user_id, user_name and user_real_name are not provided because the whole row will be loaded once more from the database when accessing them.
Parameters:
array$rowA row from the user table
array$dataFurther data to load into the object (see User::loadFromRow for valid keys)
Returns:
User

Definition at line 467 of file User.php.

Referenced by ConvertUserOptions\convertOptionBatch(), and ApiQueryUsers\execute().

static User::newFromSession ( WebRequest request = null) [static]

Create a new user object using data from session or cookies.

If the login credentials are invalid, the result is an anonymous user.

Parameters:
WebRequest$requestObject to use; $wgRequest will be used if omitted.
Returns:
User object

Definition at line 446 of file User.php.

static User::newTouchedTimestamp ( ) [static, private]

Generate a current or new-future timestamp to be stored in the user_touched field when we update things.

Returns:
string Timestamp in TS_MW format

Definition at line 2019 of file User.php.

Referenced by saveSettings().

static User::oldCrypt ( password,
userId 
) [static]

Make an old-style password hash.

Parameters:
string$passwordPlain-text password
string$userIdUser ID
Returns:
string Password hash

Definition at line 4462 of file User.php.

static User::passwordChangeInputAttribs ( ) [static]

Provide an array of HTML5 attributes to put on an input element intended for the user to enter a new password.

This may include required, title, and/or pattern, depending on $wgMinimalPasswordLength.

Do *not* use this when asking the user to enter his current password! Regardless of configuration, users may have invalid passwords for whatever reason (e.g., they were set before requirements were tightened up). Only use it when asking for a new password, like on account creation or ResetPass.

Obviously, you still need to do server-side checking.

NOTE: A combination of bugs in various browsers means that this function actually just returns array() unconditionally at the moment. May as well keep it around for when the browser bugs get fixed, though.

Todo:
FIXME: This does not belong here; put it in Html or Linker or somewhere
Returns:
array Array of HTML attributes suitable for feeding to Html::element(), directly or indirectly. (Don't feed to Xml::*()! That will get confused by the boolean attribute syntax used.)

Definition at line 4733 of file User.php.

Referenced by UsercreateTemplate\execute(), and SpecialChangePassword\pretty().

User::pingLimiter ( action = 'edit',
incrBy = 1 
)

Primitive rate limits: enforce maximum actions per time period to put a brake on flooding.

Note:
When using a shared cache like memcached, IP-address last-hit counters will be shared across wikis.
Parameters:
string$actionAction to enforce; 'edit' if unspecified
integer$incrByPositive amount to increment counter by [defaults to 1]
Returns:
bool True if a rate limiter was tripped

Definition at line 1510 of file User.php.

static User::randomPassword ( ) [static]

Return a random password.

Returns:
string New random password

Definition at line 845 of file User.php.

Referenced by TestUser\__construct(), and ApiCreateAccountTest\testValid().

User::removeGroup ( group)

Remove the user from the given group.

This takes immediate effect.

Parameters:
string$groupName of the group to remove

Definition at line 2828 of file User.php.

User::removeWatch ( title,
checkRights = WatchedItem::CHECK_USER_RIGHTS 
)

Stop watching an article.

Since:
1.22 $checkRights parameter added
Parameters:
$titleTitle of the article to look at
$checkRightsint Whether to check 'viewmywatchlist'/'editmywatchlist' rights. Pass WatchedItem::CHECK_USER_RIGHTS or WatchedItem::IGNORE_USER_RIGHTS.

Definition at line 3028 of file User.php.

Referenced by WatchAction\doUnwatch().

Determine based on the wiki configuration and the user's options, whether this user must be over HTTPS no matter what.

Returns:
bool

Definition at line 2630 of file User.php.

static User::resetIdByNameCache ( ) [static]

Reset the cache used in idFromName().

For use in tests.

Definition at line 531 of file User.php.

User::resetOptions ( resetKinds = array( 'registered', 'registered-multiselect', 'registered-checkmatrix', 'unused' ),
IContextSource context = null 
)

Reset certain (or all) options to the site defaults.

The optional parameter determines which kinds of preferences will be reset. Supported values are everything that can be reported by getOptionKinds() and 'all', which forces a reset of *all* preferences and overrides everything else.

Parameters:
array | string$resetKindswhich kinds of preferences to reset. Defaults to array( 'registered', 'registered-multiselect', 'registered-checkmatrix', 'unused' ) for backwards-compatibility.
$contextIContextSource|null context source used when $resetKinds does not contain 'all', passed to getOptionKinds(). Defaults to RequestContext::getMain() when null.

Definition at line 2567 of file User.php.

Reset a token stored in the preferences (like the watchlist one).

*Does not* save user's preferences (similarly to setOption()).

Parameters:
string$onameThe option name to reset the token in
Returns:
string|bool New token value, or false if this option is disabled.
See also:
getTokenFromOption()
setOption()

Definition at line 2439 of file User.php.

User::saveOptions ( ) [protected]
Todo:
document

Definition at line 4667 of file User.php.

Referenced by saveSettings().

Save this user's settings into the database.

Todo:
Only rarely do all these fields need to be set!

Definition at line 3283 of file User.php.

References array(), clearSharedCache(), getUserPage(), global, load(), newTouchedTimestamp(), saveOptions(), wfGetDB(), wfReadOnly(), and wfRunHooks().

Save user data to the shared cache.

Definition at line 348 of file User.php.

Referenced by loadFromId().

static User::selectFields ( ) [static]

Return the list of user fields that should be selected to create a new user object.

Returns:
array

Definition at line 4773 of file User.php.

Referenced by ApiQueryUsers\execute().

User::sendConfirmationMail ( type = 'created')

Generate a new e-mail confirmation token and send a confirmation/invalidation mail to the user's given address.

Parameters:
string$typemessage to send, either "created", "changed" or "set"
Returns:
Status object

Definition at line 3788 of file User.php.

User::sendMail ( subject,
body,
from = null,
replyto = null 
)

Send an e-mail to this user's account.

Does not check for confirmed status or validity.

Parameters:
string$subjectMessage subject
string$bodyMessage body
string$fromOptional From address; if unspecified, default $wgPasswordSender will be used
string$replytoReply-To address
Returns:
Status

Definition at line 3826 of file User.php.

User::setCookie ( name,
value,
exp = 0,
secure = null,
params = array() 
) [protected]

Set a cookie on the user's client.

Wrapper for WebResponse::setCookie

Parameters:
string$nameName of the cookie to set
string$valueValue to set
int$expExpiration time, as a UNIX time value; if 0 or not specified, use the default $wgCookieExpiration
bool$securetrue: Force setting the secure attribute when setting the cookie false: Force NOT setting the secure attribute when setting the cookie null (default): Use the default ($wgCookieSecure) to set the secure attribute
array$paramsArray of options sent passed to WebResponse::setcookie()

Definition at line 3161 of file User.php.

Referenced by doLogout().

User::setCookies ( request = null,
secure = null 
)

Set the default cookies for this session on the user's client.

Parameters:
$requestWebRequest object to use; $wgRequest will be used if null is passed.
bool$secureWhether to force secure/insecure cookies or use default

Definition at line 3186 of file User.php.

User::setEmail ( str)

Set the user's e-mail address.

Parameters:
string$strNew e-mail address

Definition at line 2241 of file User.php.

References array(), invalidateEmail(), load(), and wfRunHooks().

Set the e-mail authentication timestamp.

Parameters:
string$timestampTS_MW timestamp

Definition at line 3936 of file User.php.

References $timestamp, array(), load(), and wfRunHooks().

Set the user's e-mail address and a confirmation mail if needed.

Since:
1.20
Parameters:
string$strNew e-mail address
Returns:
Status

Definition at line 2258 of file User.php.

Referenced by Preferences\trySetUserEmail().

User::setId ( v)

Set the user and reload all fields according to a given ID.

Parameters:
int$vUser ID to reload

Definition at line 1767 of file User.php.

References clearInstanceCache().

Set the password and reset the random token unconditionally.

Parameters:
string | null$strNew password to set or null to set an invalid password hash meaning that the user will not be able to log in through the web interface.

Definition at line 2146 of file User.php.

User::setItemLoaded ( item) [protected]

Set that an item has been loaded.

Parameters:
string$item

Definition at line 918 of file User.php.

User::setName ( str)

Set the user name.

This does not reload fields from the database according to the given name. Rather, it is used to create a temporary "nonexistent user" for later addition to the database. It can also be used to set the IP address for an anonymous user to something other than the current remote IP.

Note:
User::newFromName() has roughly the same function, when the named user does not exist.
Parameters:
string$strNew user name to set

Definition at line 1803 of file User.php.

User::setNewpassword ( str,
throttle = true 
)

Set the password for a password reminder or new account email.

Parameters:
string$strNew password to set
bool$throttleIf true, reset the throttle timestamp to the present

Definition at line 2194 of file User.php.

User::setNewtalk ( val,
curRev = null 
)

Update the 'You have new messages!' status.

Parameters:
bool$valWhether the user has new messages
$curRevRevision new, as yet unseen revision of the user talk page. Ignored if null or !$val.

Definition at line 1980 of file User.php.

User::setOption ( oname,
val 
)

Set the given option for a user.

Parameters:
string$onameThe option to set
mixed$valNew value to set

Definition at line 2396 of file User.php.

User::setPassword ( str)

Set the password and reset the random token.

Calls through to authentication plugin if necessary; will have no effect if the auth plugin refuses to pass the change through or if the legal password checks fail.

As a special case, setting the password to null wipes it, so the account cannot be logged in until a new password is set, for instance via e-mail.

Parameters:
string$strNew password to set
Exceptions:
PasswordErroron failure
Returns:
bool

Definition at line 2108 of file User.php.

User::setRealName ( str)

Set the user's real name.

Parameters:
string$strNew real name

Definition at line 2303 of file User.php.

References load().

User::setToken ( token = false)

Set the random token (used for persistent authentication) Called from loadDefaults() among other places.

Parameters:
string | bool$tokenIf specified, set the token to this value

Definition at line 2179 of file User.php.

If this user is logged-in and blocked, block any IP address they've successfully logged in from.

Returns:
bool A block was spread

Definition at line 3485 of file User.php.

User::spreadBlock ( ) [protected]

If this (non-anonymous) user is blocked, block the IP address they've successfully logged in from.

Returns:
bool A block was spread

Definition at line 3497 of file User.php.

User::updateNewtalk ( field,
id,
curRev = null 
) [protected]

Add or update the new messages flag.

Parameters:
string$field'user_ip' for anonymous users, 'user_id' otherwise
string | int$idUser's IP address for anonymous users, User ID otherwise
$curRevRevision new, as yet unseen revision of the user talk page. Ignored if null.
Returns:
bool True if successful, false otherwise

Definition at line 1936 of file User.php.

Check whether to enable new pages patrol features for this user.

Returns:
bool True or false

Definition at line 2940 of file User.php.

References global, and isAllowedAny().

Check whether to enable recent changes patrol features for this user.

Returns:
boolean: True or false

Definition at line 2931 of file User.php.

References global, and isAllowedAny().

User::validateCache ( timestamp)

Validate the cache for this account.

Parameters:
string$timestampA timestamp in TS_MW format
Returns:
bool

Definition at line 2078 of file User.php.

static User::whoIs ( id) [static]

Get the username corresponding to a given user ID.

Parameters:
int$idUser ID
Returns:
string|bool The corresponding username

Definition at line 480 of file User.php.

Referenced by Title\checkActionPermissions(), UserrightsPage\fetchUser(), ImageListPager\formatValue(), Block\load(), and Block\newFromDB().

static User::whoIsReal ( id) [static]

Get the real name of a user given their user ID.

Parameters:
int$idUser ID
Returns:
string|bool The corresponding user's real name

Definition at line 490 of file User.php.


Member Data Documentation

User::$idCacheByName = array() [static]

Definition at line 240 of file User.php.

bool User::$mAllowUsertalk

Definition at line 230 of file User.php.

User::$mAllRights = false [static]

String Cached results of getAllRights()

Definition at line 180 of file User.php.

Referenced by getAllRights().

Block User::$mBlock

Definition at line 226 of file User.php.

User::$mBlockedby

Definition at line 216 of file User.php.

Block User::$mBlockedFromCreateAccount = false [private]

Definition at line 234 of file User.php.

User::$mBlockedGlobally

Definition at line 216 of file User.php.

User::$mBlockreason

Definition at line 216 of file User.php.

User::$mCacheVars [static]
Initial value:
 array(
        
        'mId',
        'mName',
        'mRealName',
        'mPassword',
        'mNewpassword',
        'mNewpassTime',
        'mEmail',
        'mTouched',
        'mToken',
        'mEmailAuthenticated',
        'mEmailToken',
        'mEmailTokenExpires',
        'mRegistration',
        'mEditCount',
        
        'mGroups',
        
        'mOptionOverrides',
    )

Array of Strings List of member variables which are saved to the shared cache (memcached).

Any operation which changes the corresponding database fields must call a cache-clearing function.

Definition at line 79 of file User.php.

User::$mCoreRights [static]
Initial value:
 array(
        'apihighlimits',
        'autoconfirmed',
        'autopatrol',
        'bigdelete',
        'block',
        'blockemail',
        'bot',
        'browsearchive',
        'createaccount',
        'createpage',
        'createtalk',
        'delete',
        'deletedhistory',
        'deletedtext',
        'deletelogentry',
        'deleterevision',
        'edit',
        'editinterface',
        'editprotected',
        'editmyoptions',
        'editmyprivateinfo',
        'editmyusercss',
        'editmyuserjs',
        'editmywatchlist',
        'editsemiprotected',
        'editusercssjs', #deprecated
        'editusercss',
        'edituserjs',
        'hideuser',
        'import',
        'importupload',
        'ipblock-exempt',
        'markbotedits',
        'mergehistory',
        'minoredit',
        'move',
        'movefile',
        'move-rootuserpages',
        'move-subpages',
        'nominornewtalk',
        'noratelimit',
        'override-export-depth',
        'passwordreset',
        'patrol',
        'patrolmarks',
        'protect',
        'proxyunbannable',
        'purge',
        'read',
        'reupload',
        'reupload-own',
        'reupload-shared',
        'rollback',
        'sendemail',
        'siteadmin',
        'suppressionlog',
        'suppressredirect',
        'suppressrevision',
        'unblockself',
        'undelete',
        'unwatchedpages',
        'upload',
        'upload_by_url',
        'userrights',
        'userrights-interwiki',
        'viewmyprivateinfo',
        'viewmywatchlist',
        'writeapi',
    )

Array of Strings Core rights.

Each of these should have a corresponding message of the form "right-$right".

Definition at line 107 of file User.php.

Referenced by getAllRights().

User::$mDatePreference

Definition at line 216 of file User.php.

User::$mEditCount

Definition at line 184 of file User.php.

User::$mEffectiveGroups

Definition at line 216 of file User.php.

User::$mEmail

Definition at line 184 of file User.php.

User::$mEmailAuthenticated

Definition at line 184 of file User.php.

User::$mEmailToken

Definition at line 184 of file User.php.

User::$mEmailTokenExpires

Definition at line 184 of file User.php.

User::$mFormerGroups

Definition at line 216 of file User.php.

User::$mFrom

String Initialization data source if mLoadedItems!==true.

May be one of:

  • 'defaults' anonymous user initialised from class defaults
  • 'name' initialise from mName
  • 'id' initialise from mId
  • 'session' log in from cookies or session if possible

Use the User::newFrom*() family of functions to set this.

Definition at line 211 of file User.php.

User::$mGroups

Definition at line 184 of file User.php.

User::$mHash

Definition at line 216 of file User.php.

User::$mHideName

Definition at line 216 of file User.php.

User::$mId

Definition at line 184 of file User.php.

User::$mImplicitGroups

Definition at line 216 of file User.php.

User::$mLoadedItems = array() [private]

Array with already loaded items or true if all items have been loaded.

Definition at line 199 of file User.php.

User::$mLocked

Definition at line 216 of file User.php.

User::$mName

Definition at line 184 of file User.php.

User::$mNewpassTime

Definition at line 184 of file User.php.

User::$mNewpassword

Definition at line 184 of file User.php.

User::$mNewtalk

Lazy-initialized variables, invalidated with clearInstanceCache.

Definition at line 216 of file User.php.

User::$mOptionOverrides

Definition at line 184 of file User.php.

User::$mOptions

Definition at line 216 of file User.php.

User::$mOptionsLoaded

Bool Whether the cache variables have been loaded.

Definition at line 194 of file User.php.

User::$mPassword

Definition at line 184 of file User.php.

User::$mRealName

Definition at line 184 of file User.php.

User::$mRegistration

Definition at line 184 of file User.php.

WebRequest User::$mRequest [private]

Definition at line 222 of file User.php.

User::$mRights

Definition at line 216 of file User.php.

User::$mToken

Definition at line 184 of file User.php.

User::$mTouched

Definition at line 184 of file User.php.

Array User::$mWatchedItems = array() [private]

Definition at line 238 of file User.php.

Definition at line 66 of file User.php.

Maximum items in $mWatchedItems.

Definition at line 71 of file User.php.

Definition at line 65 of file User.php.

Global constants made accessible as class constants so that autoloader magic can be used.

Definition at line 64 of file User.php.


The documentation for this class was generated from the following file: