Description

User class defines all functions to "get" the information (data) of a user. It is a reading class only.

This class provides all necessary functions to "read" all possible userdata. This includes required data and optional data. To set this userdata read the documentation of UserEditor.class.php which extends User.class.php

  • author: Marcel Werk
  • copyright: 2001-2009 WoltLab GmbH
  • license: GNU
DatabaseObject
   |
   --User

Direct descendents

Class Description
UserEditor UserEditor creates, edits or deletes users.
UserSession Class for user session handling. Fewer database queries through cached data in session table (user object).

Variable Summary

Type Name
mixed $groupIDs
mixed $sqlGroupBy
mixed $sqlJoins
mixed $sqlSelects
static mixed $userOptions

Method Summary

Return Name
User __construct(string $userID, [array $row = null], [string $username = null], [string $email = null])
boolean checkCookiePassword(string $passwordHash)
boolean checkPassword(string $password)
UserEditor getEditor()
array getGroupIDs()
static User getNewest()
string getSalt()
mixed getUserOption(string $name)
static void getUserOptionCache()
static integer getUserOptionID(string $name)
static array getUsers(string $userIDs)
void handleData( $data)
void __get( $name)
void __toString()

Variables

$groupIDs

protected mixed $groupIDs = null


$sqlGroupBy

protected mixed $sqlGroupBy = ''


$sqlJoins

protected mixed $sqlJoins = ''


$sqlSelects

protected mixed $sqlSelects = ''


$userOptions

protected static mixed $userOptions = null


Inherited variables from DatabaseObject

DatabaseObject::$data

Methods

__construct

public User __construct(string $userID, [array $row = null], [string $username = null], [string $email = null])

Gets the main data of the passed user (id, name or whole datablock) and pass it over to the "protected function initUser()".

You can also create an emtpy user object e.g. to search for users.

Parameters:

  • $userID
  • $row
  • $username
  • $email

Redefinition of: DatabaseObject::__construct()

Redefined in descendants as: UserSession::__construct(), WBBUserSession::__construct(), UserProfile::__construct(), WBBUser::__construct()


checkCookiePassword

public boolean checkCookiePassword(string $passwordHash)

Returns true, if the given password hash from a cookie is the correct password for this user.

  • return: password correct

Parameters:

  • $passwordHash

checkPassword

public boolean checkPassword(string $password)

Returns true, if the given password is the correct password for this user.

  • return: password correct

Parameters:

  • $password

getEditor

public UserEditor getEditor()

Returns a UserEditor object to edit this user.


getGroupIDs

public array getGroupIDs()

Returns an array with the all the groups in which the actual user is a member.


getNewest

public static User getNewest()

Gets the user with the highest registration date timestamp from database and returns a new user object with his data.


getSalt

public string getSalt()

Returns the salt of the user password.

  • return: password salt

getUserOption

public mixed getUserOption(string $name)

Returns the value of the user option with the given name.

  • return: user option value

Parameters:

  • $name - user option name

getUserOptionCache

protected static void getUserOptionCache()

Gets all user options from cache.


getUserOptionID

public static integer getUserOptionID(string $name)

Returns the id of a user option.

  • return: id

Parameters:

  • $name

getUsers

public static array getUsers(string $userIDs)

Returns a list of users.

  • return: users

Parameters:

  • $userIDs

handleData

protected void handleData( $data)


__get

public void __get( $name)

Parameters:

  • $name

Redefinition of: DatabaseObject::__get()


__toString

public void __toString()

alias of the getUsername() function

  • see: User::getUsername()

Inherited methods from DatabaseObject

DatabaseObject::__construct(), DatabaseObject::handleData(), DatabaseObject::sort(), DatabaseObject::__get()