Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZUser Class Reference

## Public Member Functions
| __construct ( $id=-1)
| store ()
| delete ()
| get ( $id=-1)
| fill (&$user_array)
| getUserByEmail ( $email)
| getUsersByEmail ( $email, $as_object=true)
| validateUser ( $login, $password)
| id ()
| signature ()
| login ( $html=true)
| infoSubscription ()
| email ()
| namedEmail ()
| accountNumber ()
| name ()
| firstName ( $html=true)
| lastName ( $html=true)
| cookieLogin ()
| simultaneousLogins ()
| setSignature ( $value)
| setLogin ( $value)
| setPassword ( $value)
| setEmail ( $value)
| setInfoSubscription ( $value)
| setAccountNumber ( $value)
| setFirstName ( $value)
| setLastName ( $value)
| setSimultaneousLogins ( $value)
| setCookieLogin ( $value)
| setGroupDefinition ( $group)
| getLogins ( $userId)
| groupString ()
| groups ( $as_object=true)
| groupDefinition ( $as_object=false)
| hasRootAccess ()
| removeGroups ()
| addAddress ( $address)
| removeAddress ( $address)
| removeAddresses ( $id=false)
| addresses ( $id=false, $as_object=true)
| mainAddress ( $as_object=true)
| trustees ( $id=-1, $as_object=false)
| getByTrustee ( $id=-1, $as_object=false)
| addTrustee ( $user)
| removeTrustee ( $user)
| setCookieValues ()
| timeoutValue ()
| search ( $queryText, $order=false, $LastName="", $FirstName="", $EMail="", $Login="", $match="AND")

## Static Public Member Functions
static & | getAllCount ( $search=false)
static & | getAll ( $order="Login", $as_object=true, $search=false, $max=-1, $index=0)
static | getUser ( $login)
static | exists ( $login)
static | loginUser (&$user)
static | autoCookieLogin ( $hash)
static | clearAutoCookieLogin ()
static | logout ()
static & | currentUser ()
static | currentUsers ()

## Public Attributes
| $ID
| $Login
| $Password
| $Email
| $FirstName
| $LastName
| $InfoSubscription
| $Signature
| $CookieLogin = 0
| $SimultaneousLogins
| $StoredTimeout
| $HasRoot
| $AccountNumber
| $GroupString
| string with the member groups, used for storing permissions in cache files More...

## Detailed Description

! eZUser eZUser handles users.

Example code:

// create a new user and set some variables.
$user = new eZUser();
$user->setLogin( "bf" );
$user->setPassword( "secret" );
$user->setEmail( "bf@ez.no" );
$user->setFirstName( "B�rd" );
$user->setLastName( "Farstad" );
$user->setSimultaneousLogins( "10" );
// check if a user with that username exists
if ( !$user->exists( $user->login() ) )
{
// Store the user to the database.
echo "Username is not used, creating user.<br>";
$user->store();
}
// validate a userlogin and password.
$user = $user->validateUser( "bf", "secret" );
if ( $user )
{
print( "Password and username are ok!<br>" );
print( $user->firstName() );
print( $user->lastName() );
}
eZUser
Definition: ezuser.php:76
$user
$user
Definition: user/adlist.php:39

See also
  eZUserGroup eZPermission eZModule eZForgot

Definition at line 75 of file ezuser.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZUser::__construct | ( |  | $id = `-1` | ) |

Constructs a new eZUser object.

If $id is set the object's values are fetched from the database.

Definition at line 83 of file ezuser.php.

References $id, $ID, and fill().

## Member Function Documentation

## ◆ accountNumber()

eZUser::accountNumber | ( |  | ) |

Returns the users account number.

Definition at line 636 of file ezuser.php.

References $AccountNumber.

## ◆ addAddress()

eZUser::addAddress | ( |  | $address | ) |

Adds an address to the current User.

Definition at line 1089 of file ezuser.php.

References $address, $db, $res, and eZDB\globalDatabase().

## ◆ addresses()

eZUser::addresses | ( |  | $id = `false`,
|  |  | $as_object = `true`
| ) |  |

Returns the addresses a user has. It is returned as an array of eZAddress objects. If the $id is supplied it is used for looking up addresses.

Definition at line 1162 of file ezuser.php.

References $address, $db, $id, $ID, $ret, and eZDB\globalDatabase().

Referenced by removeAddresses().

## ◆ addTrustee()

eZUser::addTrustee | ( |  | $user | ) |

Definition at line 1274 of file ezuser.php.

References $db, $res, $user, eZDB\finish(), and eZDB\globalDatabase().

## ◆ autoCookieLogin()

static eZUser::autoCookieLogin | ( |  | $hash | ) |
| static

Auto login in a user with a cookie. The function check the database for the same hash, if the hash is found the user is logged in.

Definition at line 837 of file ezuser.php.

References $db, $user, eZDB\globalDatabase(), and loginUser().

Referenced by ezpbKernelWeb\run().

## ◆ clearAutoCookieLogin()

static eZUser::clearAutoCookieLogin | ( |  | ) |
| static

Definition at line 857 of file ezuser.php.

References $db, $user, $userID, currentUser(), and eZDB\globalDatabase().

## ◆ cookieLogin()

eZUser::cookieLogin | ( |  | ) |

Returns the auto cookie login value.

Definition at line 673 of file ezuser.php.

References $ret.

## ◆ currentUser()

static& eZUser::currentUser | ( |  | ) |
| static

Returns the current logged on user as a eZUser object. If the user's session timeout has timedout the user is logged out.

If the session timeout is set to 0 it is disabled.

False is returned if unsuccessful.

Definition at line 896 of file ezuser.php.

References $session, $user, and eZSession\globalSession().

Referenced by eZArticle\addLog(), eZModuleHandler\all(), eZArticleCategory\articleCount(), eZArticle\articleCount(), eZArticleCategory\articles(), eZArticle\articles(), eZTopic\articles(), eZArticle\authorArticleCount(), eZArticle\authorArticleList(), eZWebDAVContentBackendAuth\authorize(), eZCart\cartTotals(), eZMailAccount\checkMail(), clearAutoCookieLogin(), eZArticleCategory\copyTree(), eZOptionValue\correctPrice(), eZProduct\correctPrice(), eZVoucherInformation\correctPrice(), eZProduct\correctPriceRange(), eZProduct\correctSavings(), eZOptionValue\correctSavings(), eZArticleCategory\countByParent(), createArticleMenu(), createQuizMenu(), eZConsultationType\delete(), eZArticleTool\deleteCache(), eZQuizTool\deleteCache(), ezpbKernelAdmin\dispatchLoop(), ezpbKernelWeb\dispatchLoop(), ezpKernelWeb\dispatchLoop(), eZMailFilter\eZMailFilter(), eZProductCategory\generatePermissionSQL(), eZMail\getByContact(), eZTodo\getByDate(), eZArticleCategory\getByParent(), eZMail\getByUser(), eZMailFolder\getByUser(), eZObjectPermission\getObjects(), eZMailFolder\getSpecialFolder(), eZVirtualFolder\getTree(), hasPermission(), eZObjectPermission\hasPermission(), eZProductPermission\hasPermission(), eZObjectPermission\hasPermissionWithDefinition(), eZImageCategory\imageCount(), eZImageCategory\images(), ezpRestClient\isAuthorizedByUser(), eZForumMessage\lastMessages(), eZProduct\localePrice(), eZProduct\localeSavings(), eZArticle\manualKeywordIndex(), eZWishListItem\moveToCart(), eZArticleTool\notificationMessage(), eZProductCategory\products(), eZProduct\products(), eZFormRenderer\renderForm(), ezpbKernelAdmin\run(), ezpbKernelWeb\run(), ezpKernelTreeMenu\run(), ezpKernelWeb\run(), save_mail(), eZImageCategory\search(), eZArticleCategory\search(), eZForum\search(), eZMail\search(), eZVirtualFile\search(), eZImage\search(), eZArticle\search(), eZArticle\searchByShortContent(), eZImage\searchCount(), eZVirtualFile\searchCount(), eZArticle\searchTitle(), setCookieValues(), eZArticle\setIsPublished(), eZPreferences\setVariable(), eZPageView\store(), eZOrder\store(), eZPreferences\variable(), eZProduct\vatType(), eZShippingType\vatType(), and writeAtAll().

## ◆ currentUsers()

static eZUser::currentUsers | ( |  | ) |
| static

Returns the currently logged in users with sessions. It is returned as an array of eZUser and eZSession objects.

Definition at line 946 of file ezuser.php.

References $ret, $session, $user, and eZSession\globalSession().

Referenced by getLogins().

## ◆ delete()

eZUser::delete | ( |  | ) |

Deletes a eZUser object from the database.

Definition at line 245 of file ezuser.php.

References $db, and eZDB\globalDatabase().

## ◆ email()

eZUser::email | ( |  | ) |

Returns the users e-mail address.

Definition at line 620 of file ezuser.php.

References $Email.

Referenced by namedEmail().

## ◆ exists()

static eZUser::exists | ( |  | $login | ) |
| static

Returns the eZUser object if a user with that login exits.

False (0) is returned if not.

Definition at line 556 of file ezuser.php.

References $db, $ret, $user_array, and eZDB\globalDatabase().

## ◆ fill()

eZUser::fill | ( | & | $user_array | ) |

Fills in information to the object taken from the array.

Definition at line 291 of file ezuser.php.

References $db, $user_array, Email, and eZDB\globalDatabase().

Referenced by __construct(), and get().

## ◆ firstName()

eZUser::firstName | ( |  | $html = `true` | ) |

Returns the users first name.

Definition at line 651 of file ezuser.php.

References $FirstName.

Referenced by name().

## ◆ get()

eZUser::get | ( |  | $id = `-1` | ) |

Fetches the object information from the database.

True is retuned if successful, false (0) if not.

Definition at line 266 of file ezuser.php.

References $db, $id, $ret, $user_array, fill(), and eZDB\globalDatabase().

## ◆ getAll()

static& eZUser::getAll | ( |  | $order = `"Login"`,
|  |  | $as_object = `true`,
|  |  | $search = `false`,
|  |  | $max = `-1`,
|  |  | $index = `0`
| ) |  |
| static

Fetches the user id from the database. And returns a array of eZUser objects.

Definition at line 330 of file ezuser.php.

References $db, $index, $order, $search, $user, $user_array, and eZDB\globalDatabase().

## ◆ getAllCount()

static& eZUser::getAllCount | ( |  | $search = `false` | ) |
| static

Returns the number of rows a getAll with the same search param would give.

Definition at line 311 of file ezuser.php.

References $db, $query, $search, $user_array, and eZDB\globalDatabase().

## ◆ getByTrustee()

eZUser::getByTrustee | ( |  | $id = `-1`,
|  |  | $as_object = `false`
| ) |  |

Definition at line 1247 of file ezuser.php.

References $db, $id, $ID, $ret, and eZDB\globalDatabase().

## ◆ getLogins()

eZUser::getLogins | ( |  | $userId | ) |

Returns the current number of logged in users on one userid.

Definition at line 981 of file ezuser.php.

References $userSessionList, and currentUsers().

## ◆ getUser()

static eZUser::getUser | ( |  | $login | ) |
| static

Returns the eZUser object where login = $login.

False (0) is returned if the users isn't validated.

Definition at line 420 of file ezuser.php.

References $db, $ret, $user_array, and eZDB\globalDatabase().

## ◆ getUserByEmail()

eZUser::getUserByEmail | ( |  | $email | ) |

Returns the eZUser object where email = $email.

False (0) is returned if the users isn't validated.

Definition at line 438 of file ezuser.php.

References $db, $user_array, and eZDB\globalDatabase().

## ◆ getUsersByEmail()

eZUser::getUsersByEmail | ( |  | $email,
|  |  | $as_object = `true`
| ) |  |

Returns the eZUser object where email = $email.

False (0) is returned if the users isn't validated.

Definition at line 462 of file ezuser.php.

References $db, $user, $user_array, and eZDB\globalDatabase().

## ◆ groupDefinition()

eZUser::groupDefinition | ( |  | $as_object = `false` | ) |

Definition at line 1037 of file ezuser.php.

References $db, $groups, and eZDB\globalDatabase().

## ◆ groups()

eZUser::groups | ( |  | $as_object = `true` | ) |

Returns the user groups the current user is a member of. The result is returned as an array of eZUserGroup objects if $IDOnly = false. If not only an array with the ID's is returned.

Definition at line 1021 of file ezuser.php.

References $db, $group, $ret, and eZDB\globalDatabase().

Referenced by groupString().

## ◆ groupString()

eZUser::groupString | ( |  | ) |

Returns the member group id's of the user as a string sorted by id.

e.g. 1-2-3-4-6

Definition at line 998 of file ezuser.php.

References $groupID, $GroupString, and groups().

## ◆ hasRootAccess()

eZUser::hasRootAccess | ( |  | ) |

Static function..check if the user given has root access

Definition at line 1056 of file ezuser.php.

References $db, $HasRoot, $result, and eZDB\globalDatabase().

## ◆ id()

eZUser::id | ( |  | ) |

Returns the object id.

Definition at line 576 of file ezuser.php.

References $ID.

## ◆ infoSubscription()

eZUser::infoSubscription | ( |  | ) |

Returns the users InfoSubscription.

Definition at line 605 of file ezuser.php.

References $ret.

## ◆ lastName()

eZUser::lastName | ( |  | $html = `true` | ) |

Returns the users last name.

Definition at line 662 of file ezuser.php.

References $LastName.

Referenced by name().

## ◆ login()

eZUser::login | ( |  | $html = `true` | ) |

Returns the users login.

Definition at line 593 of file ezuser.php.

References $Login.

## ◆ loginUser()

static eZUser::loginUser | ( | & | $user | ) |
| static

Logs in the user given argument. The $user argument must be a eZUser object.

Returns false if unsuccess ful, true if successful.

Definition at line 809 of file ezuser.php.

References $ret, $session, $user, and eZSession\globalSession().

Referenced by autoCookieLogin().

## ◆ logout()

static eZUser::logout | ( |  | ) |
| static

Logs out a user.

Definition at line 876 of file ezuser.php.

References $session, and eZSession\globalSession().

## ◆ mainAddress()

eZUser::mainAddress | ( |  | $as_object = `true` | ) |

Returns the main address the user has. It is returned as an eZAddress objects. If the $id is supplied it is used for looking up addresses.

Definition at line 1195 of file ezuser.php.

References $db, $id, $ID, $ret, and eZDB\globalDatabase().

## ◆ name()

eZUser::name | ( |  | ) |

Returns the users first and last name with a space in between.

Definition at line 643 of file ezuser.php.

References firstName(), and lastName().

Referenced by namedEmail().

## ◆ namedEmail()

eZUser::namedEmail | ( |  | ) |

Returns the users name and email where the email is surrounded by <>.

Definition at line 628 of file ezuser.php.

References email(), and name().

## ◆ removeAddress()

eZUser::removeAddress | ( |  | $address | ) |

Remove address from a user. The function also remove the address from the database.

Definition at line 1117 of file ezuser.php.

References $address, $db, $res, eZAddress\delete(), and eZDB\globalDatabase().

## ◆ removeAddresses()

eZUser::removeAddresses | ( |  | $id = `false` | ) |

Remove all addresses from a user. The function also remove the addresses from the database. If the $id is supplied it is used for looking up addresses.

Definition at line 1143 of file ezuser.php.

References $address, $db, $id, $ID, addresses(), eZAddress\delete(), and eZDB\globalDatabase().

## ◆ removeGroups()

eZUser::removeGroups | ( |  | ) |

Removes the user from every user group.

Definition at line 1079 of file ezuser.php.

References $db, and eZDB\globalDatabase().

## ◆ removeTrustee()

eZUser::removeTrustee | ( |  | $user | ) |

Definition at line 1290 of file ezuser.php.

References $db, $res, $user, eZDB\finish(), and eZDB\globalDatabase().

## ◆ search()

eZUser::search | ( |  | $queryText,
|  |  | $order = `false`,
|  |  | $LastName = `""`,
|  |  | $FirstName = `""`,
|  |  | $EMail = `""`,
|  |  | $Login = `""`,
|  |  | $match = `"AND"`
| ) |  |

Searches for users matching the queryText and returns them as an array of eZUser objects.

Definition at line 1367 of file ezuser.php.

References $db, $EMail, $FirstName, $i, $LastName, $Login, $order, $query, $user_array, and eZDB\globalDatabase().

## ◆ setAccountNumber()

eZUser::setAccountNumber | ( |  | $value | ) |

Sets the users account number.

Definition at line 744 of file ezuser.php.

## ◆ setCookieLogin()

eZUser::setCookieLogin | ( |  | $value | ) |

Sets the auto cookie login value on this account.

Definition at line 777 of file ezuser.php.

## ◆ setCookieValues()

eZUser::setCookieValues | ( |  | ) |

Definition at line 1303 of file ezuser.php.

References $db, $res, $user, $userID, currentUser(), and eZDB\globalDatabase().

## ◆ setEmail()

eZUser::setEmail | ( |  | $value | ) |

Sets the email address to the user.

Definition at line 718 of file ezuser.php.

References Email.

## ◆ setFirstName()

eZUser::setFirstName | ( |  | $value | ) |

Sets the users first name.

Definition at line 751 of file ezuser.php.

## ◆ setGroupDefinition()

eZUser::setGroupDefinition | ( |  | $group | ) |

Definition at line 785 of file ezuser.php.

References $db, $group, $res, eZDB\finish(), and eZDB\globalDatabase().

## ◆ setInfoSubscription()

eZUser::setInfoSubscription | ( |  | $value | ) |

Sets the infoSubscription to the user.

This value indicates if the user wants to receive updates from the site. true and false are valid arguments.

Definition at line 729 of file ezuser.php.

## ◆ setLastName()

eZUser::setLastName | ( |  | $value | ) |

Sets the users last name.

Definition at line 759 of file ezuser.php.

## ◆ setLogin()

eZUser::setLogin | ( |  | $value | ) |

Sets the login.

Definition at line 701 of file ezuser.php.

## ◆ setPassword()

eZUser::setPassword | ( |  | $value | ) |

Sets the password.

Definition at line 710 of file ezuser.php.

References Password.

## ◆ setSignature()

eZUser::setSignature | ( |  | $value | ) |

Sets the signature.

Definition at line 693 of file ezuser.php.

## ◆ setSimultaneousLogins()

eZUser::setSimultaneousLogins | ( |  | $value | ) |

Sets the number of simultaneous connections on this account.

Definition at line 767 of file ezuser.php.

## ◆ signature()

eZUser::signature | ( |  | ) |

Returns the signature.

Definition at line 585 of file ezuser.php.

References $Signature.

## ◆ simultaneousLogins()

eZUser::simultaneousLogins | ( |  | ) |

Returns the number og simultaneous logins allowed on this account.

Definition at line 685 of file ezuser.php.

## ◆ store()

eZUser::store | ( |  | ) |

Stores or updates a eZUser object in the database.

Definition at line 105 of file ezuser.php.

References $db, Email, eZDB\globalDatabase(), and Password.

## ◆ timeoutValue()

eZUser::timeoutValue | ( |  | ) |

Returns the timeout for the user. If the user is not a member of any user groups the timeout is set to 30. If the user is a member of several user groups, the fastest timeout is returned.

Definition at line 1340 of file ezuser.php.

References $db, $ret, $StoredTimeout, and eZDB\globalDatabase().

## ◆ trustees()

eZUser::trustees | ( |  | $id = `-1`,
|  |  | $as_object = `false`
| ) |  |

Definition at line 1220 of file ezuser.php.

References $db, $id, $ID, $ret, and eZDB\globalDatabase().

## ◆ validateUser()

eZUser::validateUser | ( |  | $login,
|  |  | $password
| ) |  |

Returns the correct eZUser object if the user is validated.

False (0) is returned if the user isn't validated.

Definition at line 505 of file ezuser.php.

References $db, $ret, $user_array, and eZDB\globalDatabase().

## Member Data Documentation

## ◆ $AccountNumber

eZUser::$AccountNumber

Definition at line 1438 of file ezuser.php.

Referenced by accountNumber().

## ◆ $CookieLogin

eZUser::$CookieLogin = 0

Definition at line 1434 of file ezuser.php.

## ◆ $Email

eZUser::$Email

Definition at line 1429 of file ezuser.php.

Referenced by email().

## ◆ $FirstName

eZUser::$FirstName

Definition at line 1430 of file ezuser.php.

Referenced by firstName(), and search().

## ◆ $GroupString

eZUser::$GroupString

string with the member groups, used for storing permissions in cache files

Definition at line 1441 of file ezuser.php.

Referenced by groupString().

## ◆ $HasRoot

eZUser::$HasRoot

Definition at line 1437 of file ezuser.php.

Referenced by hasRootAccess().

## ◆ $ID

eZUser::$ID

Definition at line 1426 of file ezuser.php.

Referenced by __construct(), addresses(), getByTrustee(), id(), mainAddress(), removeAddresses(), and trustees().

## ◆ $InfoSubscription

eZUser::$InfoSubscription

Definition at line 1432 of file ezuser.php.

## ◆ $LastName

eZUser::$LastName

Definition at line 1431 of file ezuser.php.

Referenced by lastName(), and search().

## ◆ $Login

eZUser::$Login

Definition at line 1427 of file ezuser.php.

Referenced by login(), and search().

## ◆ $Password

eZUser::$Password

Definition at line 1428 of file ezuser.php.

## ◆ $Signature

eZUser::$Signature

Definition at line 1433 of file ezuser.php.

Referenced by signature().

## ◆ $SimultaneousLogins

eZUser::$SimultaneousLogins

Definition at line 1435 of file ezuser.php.

## ◆ $StoredTimeout

eZUser::$StoredTimeout

Definition at line 1436 of file ezuser.php.

Referenced by timeoutValue().

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

- ezuser.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.