GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Get MediaWiki
  • Get extensions
  • Tech blog
  • Contribute
  • User help
  • FAQ
  • Technical manual
  • Support desk
  • Communication
  • Developer portal
  • Code statistics
  • Community portal
  • Recent changes

This view

  • Original page
  • New address

GeezerVison is showing www.mediawiki.org — Manual:User.php - MediaWiki

MediaWiki file: User.php
Location: includes/user/ (includes/User/ in 1.46 or later)
Source code: master • 1.46.2 • 1.45.6 • 1.43.11
Classes: MediaWiki\User\User

Description

User.php implements the User class, which encapsulates all of the user-specific settings (user_id, name, rights, 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.

createAndPromote.php uses User::newFromName(), User::addToDatabase(), and User::saveSettings().

The User class used to contain password handling, but it was removed with the introduction of AuthManager.

Static factory methods

Note: In modern MediaWiki versions (MW1.35+), it is better to get a UserFactory instance and use the non-static equivalents there.

  • static newFromName ($name, $validate= 'valid')
  • static newFromId ($id)
  • static newFromConfirmationCode ($code)
  • static newFromSession (WebRequest $request=null)
  • static newFromRow ($row, $data=null)

Other methods

There are a whole host of other ones. See https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWiki_1_1User_1_1User.html for the full list.

  • getId(): Get the user's ID. Returns 0 if the user is anonymous or nonexistent.
  • getName(): Get the user name, or the IP of an anonymous user.
  • getEmail(): Get the user's email address.
  • getGroups(): Get the list of explicit group memberships this user has. (The implicit * and user groups are not included.) (removed) Use UserGroupManager->getUserGroups() instead.
  • getRights(): Get the permissions this user has.

See also

  • Manual:$wgUser - global user object (deprecated)
  • Manual:RequestContext.php - Used to get the User associated with a request.
  • Manual:Central ID
  • Manual:Code
  • Manual:Coding conventions
  • Category:MediaWiki hooks included in User.php
Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:User.php&oldid=7799643"
Category:
  • MediaWiki code
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.