Documentation

CUser Class

CUser class to handle user data.

An instance of this class ($USER - current user data) is created automatically each time when every page is executed.

Equivalent to the class in the new core D7 - Bitrix\Main\UserTable.

Fields

Field Type Description
ID int User ID.
XML_ID int User ID for binding to external sources (e.g. the ID of a user in an external database).
TIMESTAMP_X datetime Date and time of the last modification.
LOGIN varchar (50) Login name.
PASSWORD varchar (50) Password hash.
STORED_HASH varchar (32) Password hash stored in the user cookie.
CHECKWORD varchar (50) Check string used for the password change.
ACTIVE char Active (Y|N).
NAME varchar (50) Name.
LAST_NAME varchar (50) Last name.
SECOND_NAME varchar (50) Middle name.
EMAIL varchar (255) E-mail address.
LAST_LOGIN datetime Date of the last authorization.
LAST_ACTIVITY_DATE datetime Date the user has been registered.
DATE_REGISTER datetime Date the user has been registered.
LID char (2) The ID of the default site used for notifications.
ADMIN_NOTES varchar (2000) Administrator comments.
EXTERNAL_AUTH_ID varchar (255) The ID of the external authorization source.
Personal data:
PERSONAL_PROFESSION varchar (255) Position/job.
PERSONAL_WWW varchar (255) Web page.
PERSONAL_ICQ varchar (255) ICQ.
PERSONAL_GENDER char (1) Gender.
PERSONAL_BIRTHDAY date Date of birth.
PERSONAL_PHOTO int Photo.
PERSONAL_PHONE varchar (255) Phone number.
PERSONAL_FAX varchar (255) Fax.
PERSONAL_MOBILE varchar (255) Mobile phone.
PERSONAL_PAGER varchar (255) Pager.
PERSONAL_STREET varchar (2000) Street address.
PERSONAL_MAILBOX varchar (255) Mailbox number.
PERSONAL_CITY varchar (255) City.
PERSONAL_STATE varchar (255) State of region.
PERSONAL_ZIP varchar (255) Zip code.
PERSONAL_COUNTRY varchar (255) Country.
PERSONAL_NOTES varchar (2000) Additional notes.
Job information:
WORK_COMPANY varchar (255) Company name.
WORK_DEPARTMENT varchar (255) Department.
WORK_POSITION varchar (255) Position.
WORK_WWW varchar (255) Web page.
WORK_PHONE varchar (255) Phone number.
WORK_FAX varchar (255) Fax.
WORK_PAGER varchar (255) Pager.
WORK_STREET varchar (2000) Street number.
WORK_MAILBOX varchar (255) Mailbox number.
WORK_CITY varchar (255) City.
WORK_STATE varchar (255) State of region.
WORK_ZIP varchar (255) Zip code.
WORK_COUNTRY varchar (255) Country.
WORK_PROFILE varchar (2000) Company profile.
WORK_LOGO int Logo.
WORK_NOTES varchar (2000) Additional notes.

Class methods

Method Description Available from version
GetList Returns a list of users.
GetByID Returns a user by its ID.
GetByLogin Returns a user by the login.
GetUserGroup Returns an array of ID's of groups containing the specified user.
Add Adds a new user.
Update Modifies parameters of the user.
Delete Deletes a user.
GetID Returns the authorized user ID.
GetLogin Returns the login of the currently authorized user.
GetEmail Returns the e-mail address of the currently authorized user.
GetFullName Returns the first and last names of the authorized user.
GetFirstName Returns the authorized user name.
GetLastName Returns the last name of the authorized user.
GetParam Returns one of the user parameters stored in the authorization session.
GetUserGroupArray Returns the ID's of groups containing the current authorized user.
GetUserGroupList Returns the list of group, containing the current authorized user.
GetUserGroupString Returns the string with comma-separated ID's of all groups containing the current authorized user.
IsAdmin Checks if the current authorized user belongs to the Administrators group.
IsAuthorized Checks if the site visitor has been authorized.
IsOnLine Defines status of "Now online" by the user ID.
Login Verifies the login and password and performs or declines the user authorization.
LoginByHash Verifies the login and a password hash string performs or declines the user authorization.
SavePasswordHash Stores the special hash string in the user cookie for future automatic authorization.
GetPasswordHash vReturns a hash string on the user password that can be used with LoginByHash and SavePasswordHash functions.
Authorize Implements the user authorization procedure. Initializes both session and CUser variables.
Logout Ends the user authorized session.
Register Registers and authorizes a new user. Sends a registration email created via NEW_USER template type.
SimpleRegister Creates and authorizes a new user by generating the random login and password. Only an email is received on the method input.
ChangePassword Modifies the user password.
SendPassword Sends a message with the control string used for password change.
SendUserInfo Sends an e-mail message with the user preferences.
GetCount Returns the number of users registered with the site.
GetExternalAuthList Returns list of all sources of external authorization.
SetParam Sets an arbitrary user parameter "param_name" to store an authorization session.
SetUserGroup Set "user_id" binding to the "groups" parameter.
SetUserGroupArray Sets binding of the current user to the "groups" parameter.
SetLastActivityDate Updates the LAST_ACTIVITY_DATE parameter
CanDoFileOperation Defines scope of operations for files.


© «Bitrix24», 2001-2024
Up