class user extends abstract_moodle_entity

User Entity (Moodle Native).

Properties

protected int $id from  abstract_moodle_entity
protected int $timecreated from  abstract_moodle_entity
protected int $timemodified from  abstract_moodle_entity
protected string $auth
protected int $confirmed
protected int $policyagreed
protected int $deleted
protected int $suspended
protected int $mnethostid
protected string $username
protected string $password
protected string $idnumber
protected string $firstname
protected string $lastname
protected string $email
protected int $emailstop
protected string $phone1
protected string $phone2
protected string $institution
protected string $department
protected string $address
protected string $city
protected string $country
protected string $lang
protected string $calendartype
protected string $theme
protected string $timezone
protected int $firstaccess
protected int $lastaccess
protected int $lastlogin
protected int $currentlogin
protected string $lastip
protected string $secret
protected int $picture
protected string|null $description
protected int $descriptionformat
protected int $mailformat
protected int $maildigest
protected int $maildisplay
protected int $autosubscribe
protected int $trackforums
protected int $trustbitmask
protected string|null $imagealt
protected string|null $lastnamephonetic
protected string|null $firstnamephonetic
protected string|null $middlename
protected string|null $alternatename
protected string|null $moodlenetprofile

Methods

mixed
__get(string $name)

Magic getter to allow reading protected properties.

bool
__isset(string $name)

Magic isset to allow checking protected properties.

void
__set(string $name, mixed $value)

Magic setter.

array
jsonSerialize()

Serializes the object to a value that can be natively serialized by json_encode().

mixed
__call(string $name, array $arguments)

Magic accessor to support get* and with* helpers for entity properties.

static string
get_table()

Returns the Moodle database table name.

from_record(array|stdClass $record)

Factory method to create an entity from a Moodle record.

to_record()

Converts the entity to a stdClass record for Moodle APIs.

as_std_class()

Returns the entity as stdClass (alias for to_record).

int|null
get_id()

Get the entity unique identifier.

with_id(int|null $id)

Set entity identifier.

int
get_timecreated()

Get entity creation timestamp.

with_timecreated(int $timecreated)

Set entity creation timestamp.

int
get_timemodified()

Get entity modification timestamp.

with_timemodified(int $timemodified)

Set entity modification timestamp.

array
to_array()

Implementation for entity_interface.

string
get_fullname()

Helper to get fullname.

string
get_auth()

Get authentication plugin.

with_auth(string $auth)

Set authentication plugin.

int
get_confirmed()

Get confirmation flag.

with_confirmed(int $confirmed)

Set confirmation flag.

int
get_policyagreed()

Get policy agreement flag.

with_policyagreed(int $policyagreed)

Set policy agreement flag.

int
get_deleted()

Get deleted flag.

with_deleted(int $deleted)

Set deleted flag.

int
get_suspended()

Get suspended flag.

with_suspended(int $suspended)

Set suspended flag.

int
get_mnethostid()

Get MNet host identifier.

with_mnethostid(int $mnethostid)

Set MNet host identifier.

string
get_username()

Get username.

with_username(string $username)

Set username.

string
get_password()

Get hashed password.

with_password(string $password)

Set hashed password.

string
get_idnumber()

Get idnumber.

with_idnumber(string $idnumber)

Set idnumber.

string
get_firstname()

Get first name.

with_firstname(string $firstname)

Set first name.

string
get_lastname()

Get last name.

with_lastname(string $lastname)

Set last name.

string
get_email()

Get email.

with_email(string $email)

Set email.

int
get_emailstop()

Get email stop flag.

with_emailstop(int $emailstop)

Set email stop flag.

string
get_phone1()

Get primary phone.

with_phone1(string $phone1)

Set primary phone.

string
get_phone2()

Get secondary phone.

with_phone2(string $phone2)

Set secondary phone.

string
get_institution()

Get institution.

with_institution(string $institution)

Set institution.

string
get_department()

Get department.

with_department(string $department)

Set department.

string
get_address()

Get address.

with_address(string $address)

Set address.

string
get_city()

Get city.

with_city(string $city)

Set city.

string
get_country()

Get country code.

with_country(string $country)

Set country code.

string
get_lang()

Get language.

with_lang(string $lang)

Set language.

string
get_calendartype()

Get calendar type.

with_calendartype(string $calendartype)

Set calendar type.

string
get_theme()

Get theme.

with_theme(string $theme)

Set theme.

string
get_timezone()

Get timezone.

with_timezone(string $timezone)

Set timezone.

int
get_firstaccess()

Get first access timestamp.

with_firstaccess(int $firstaccess)

Set first access timestamp.

int
get_lastaccess()

Get last access timestamp.

with_lastaccess(int $lastaccess)

Set last access timestamp.

int
get_lastlogin()

Get last login timestamp.

with_lastlogin(int $lastlogin)

Set last login timestamp.

int
get_currentlogin()

Get current login timestamp.

with_currentlogin(int $currentlogin)

Set current login timestamp.

string
get_lastip()

Get last IP.

with_lastip(string $lastip)

Set last IP.

string
get_secret()

Get secret string.

with_secret(string $secret)

Set secret string.

int
get_picture()

Get picture revision.

with_picture(int $picture)

Set picture revision.

string|null
get_description()

Get description.

with_description(string|null $description)

Set description.

int
get_descriptionformat()

Get description format.

with_descriptionformat(int $descriptionformat)

Set description format.

int
get_mailformat()

Get mail format.

with_mailformat(int $mailformat)

Set mail format.

int
get_maildigest()

Get mail digest mode.

with_maildigest(int $maildigest)

Set mail digest mode.

int
get_maildisplay()

Get mail display preference.

with_maildisplay(int $maildisplay)

Set mail display preference.

int
get_autosubscribe()

Get autosubscribe preference.

with_autosubscribe(int $autosubscribe)

Set autosubscribe preference.

int
get_trackforums()

Get forums tracking preference.

with_trackforums(int $trackforums)

Set forums tracking preference.

int
get_trustbitmask()

Get trust bitmask.

with_trustbitmask(int $trustbitmask)

Set trust bitmask.

string|null
get_imagealt()

Get image alt text.

with_imagealt(string|null $imagealt)

Set image alt text.

string|null
get_lastnamephonetic()

Get lastname phonetic.

with_lastnamephonetic(string|null $lastnamephonetic)

Set lastname phonetic.

string|null
get_firstnamephonetic()

Get firstname phonetic.

with_firstnamephonetic(string|null $firstnamephonetic)

Set firstname phonetic.

string|null
get_middlename()

Get middle name.

with_middlename(string|null $middlename)

Set middle name.

string|null
get_alternatename()

Get alternate name.

with_alternatename(string|null $alternatename)

Set alternate name.

string|null
get_moodlenetprofile()

Get MoodleNet profile.

with_moodlenetprofile(string|null $moodlenetprofile)

Set MoodleNet profile.

Details

in abstract_entity at line 39
mixed __get(string $name)

Magic getter to allow reading protected properties.

Parameters

string $name

Property name

Return Value

mixed

in abstract_entity at line 55
bool __isset(string $name)

Magic isset to allow checking protected properties.

Parameters

string $name

Property name

Return Value

bool

in abstract_entity at line 66
void __set(string $name, mixed $value)

Magic setter.

Parameters

string $name

Property name

mixed $value Value

Return Value

void

in abstract_entity at line 80
array jsonSerialize()

Serializes the object to a value that can be natively serialized by json_encode().

Return Value

array

mixed __call(string $name, array $arguments)

Magic accessor to support get* and with* helpers for entity properties.

Parameters

string $name
array $arguments

Return Value

mixed

at line 120
static string get_table()

Returns the Moodle database table name.

Return Value

string

static abstract_moodle_entity from_record(array|stdClass $record)

Factory method to create an entity from a Moodle record.

Automatically casts values to match property types (int, string, etc.) since Moodle's database layer often returns numeric values as strings.

Parameters

array|stdClass $record

Return Value

abstract_moodle_entity

stdClass to_record()

Converts the entity to a stdClass record for Moodle APIs.

Return Value

stdClass

stdClass as_std_class()

Returns the entity as stdClass (alias for to_record).

Return Value

stdClass

int|null get_id()

Get the entity unique identifier.

Return Value

int|null

abstract_moodle_entity with_id(int|null $id)

Set entity identifier.

Parameters

int|null $id

Return Value

abstract_moodle_entity

int get_timecreated()

Get entity creation timestamp.

Return Value

int

abstract_moodle_entity with_timecreated(int $timecreated)

Set entity creation timestamp.

Parameters

int $timecreated

Return Value

abstract_moodle_entity

int get_timemodified()

Get entity modification timestamp.

Return Value

int

abstract_moodle_entity with_timemodified(int $timemodified)

Set entity modification timestamp.

Parameters

int $timemodified

Return Value

abstract_moodle_entity

array to_array()

Implementation for entity_interface.

Return Value

array

at line 130
string get_fullname()

Helper to get fullname.

Return Value

string

at line 140
string get_auth()

Get authentication plugin.

Return Value

string

at line 152
user with_auth(string $auth)

Set authentication plugin.

Parameters

string $auth

Return Value

user

at line 164
int get_confirmed()

Get confirmation flag.

Return Value

int

at line 176
user with_confirmed(int $confirmed)

Set confirmation flag.

Parameters

int $confirmed

Return Value

user

at line 188
int get_policyagreed()

Get policy agreement flag.

Return Value

int

at line 200
user with_policyagreed(int $policyagreed)

Set policy agreement flag.

Parameters

int $policyagreed

Return Value

user

at line 212
int get_deleted()

Get deleted flag.

Return Value

int

at line 224
user with_deleted(int $deleted)

Set deleted flag.

Parameters

int $deleted

Return Value

user

at line 236
int get_suspended()

Get suspended flag.

Return Value

int

at line 248
user with_suspended(int $suspended)

Set suspended flag.

Parameters

int $suspended

Return Value

user

at line 260
int get_mnethostid()

Get MNet host identifier.

Return Value

int

at line 272
user with_mnethostid(int $mnethostid)

Set MNet host identifier.

Parameters

int $mnethostid

Return Value

user

at line 284
string get_username()

Get username.

Return Value

string

at line 296
user with_username(string $username)

Set username.

Parameters

string $username

Return Value

user

at line 308
string get_password()

Get hashed password.

Return Value

string

at line 320
user with_password(string $password)

Set hashed password.

Parameters

string $password

Return Value

user

at line 332
string get_idnumber()

Get idnumber.

Return Value

string

at line 344
user with_idnumber(string $idnumber)

Set idnumber.

Parameters

string $idnumber

Return Value

user

at line 356
string get_firstname()

Get first name.

Return Value

string

at line 368
user with_firstname(string $firstname)

Set first name.

Parameters

string $firstname

Return Value

user

at line 380
string get_lastname()

Get last name.

Return Value

string

at line 392
user with_lastname(string $lastname)

Set last name.

Parameters

string $lastname

Return Value

user

at line 404
string get_email()

Get email.

Return Value

string

at line 416
user with_email(string $email)

Set email.

Parameters

string $email

Return Value

user

at line 428
int get_emailstop()

Get email stop flag.

Return Value

int

at line 440
user with_emailstop(int $emailstop)

Set email stop flag.

Parameters

int $emailstop

Return Value

user

at line 452
string get_phone1()

Get primary phone.

Return Value

string

at line 464
user with_phone1(string $phone1)

Set primary phone.

Parameters

string $phone1

Return Value

user

at line 476
string get_phone2()

Get secondary phone.

Return Value

string

at line 488
user with_phone2(string $phone2)

Set secondary phone.

Parameters

string $phone2

Return Value

user

at line 500
string get_institution()

Get institution.

Return Value

string

at line 512
user with_institution(string $institution)

Set institution.

Parameters

string $institution

Return Value

user

at line 524
string get_department()

Get department.

Return Value

string

at line 536
user with_department(string $department)

Set department.

Parameters

string $department

Return Value

user

at line 548
string get_address()

Get address.

Return Value

string

at line 560
user with_address(string $address)

Set address.

Parameters

string $address

Return Value

user

at line 572
string get_city()

Get city.

Return Value

string

at line 584
user with_city(string $city)

Set city.

Parameters

string $city

Return Value

user

at line 596
string get_country()

Get country code.

Return Value

string

at line 608
user with_country(string $country)

Set country code.

Parameters

string $country

Return Value

user

at line 620
string get_lang()

Get language.

Return Value

string

at line 632
user with_lang(string $lang)

Set language.

Parameters

string $lang

Return Value

user

at line 644
string get_calendartype()

Get calendar type.

Return Value

string

at line 656
user with_calendartype(string $calendartype)

Set calendar type.

Parameters

string $calendartype

Return Value

user

at line 668
string get_theme()

Get theme.

Return Value

string

at line 680
user with_theme(string $theme)

Set theme.

Parameters

string $theme

Return Value

user

at line 692
string get_timezone()

Get timezone.

Return Value

string

at line 704
user with_timezone(string $timezone)

Set timezone.

Parameters

string $timezone

Return Value

user

at line 716
int get_firstaccess()

Get first access timestamp.

Return Value

int

at line 728
user with_firstaccess(int $firstaccess)

Set first access timestamp.

Parameters

int $firstaccess

Return Value

user

at line 740
int get_lastaccess()

Get last access timestamp.

Return Value

int

at line 752
user with_lastaccess(int $lastaccess)

Set last access timestamp.

Parameters

int $lastaccess

Return Value

user

at line 764
int get_lastlogin()

Get last login timestamp.

Return Value

int

at line 776
user with_lastlogin(int $lastlogin)

Set last login timestamp.

Parameters

int $lastlogin

Return Value

user

at line 788
int get_currentlogin()

Get current login timestamp.

Return Value

int

at line 800
user with_currentlogin(int $currentlogin)

Set current login timestamp.

Parameters

int $currentlogin

Return Value

user

at line 812
string get_lastip()

Get last IP.

Return Value

string

at line 824
user with_lastip(string $lastip)

Set last IP.

Parameters

string $lastip

Return Value

user

at line 836
string get_secret()

Get secret string.

Return Value

string

at line 848
user with_secret(string $secret)

Set secret string.

Parameters

string $secret

Return Value

user

at line 860
int get_picture()

Get picture revision.

Return Value

int

at line 872
user with_picture(int $picture)

Set picture revision.

Parameters

int $picture

Return Value

user

at line 884
string|null get_description()

Get description.

Return Value

string|null

at line 896
user with_description(string|null $description)

Set description.

Parameters

string|null $description

Return Value

user

at line 908
int get_descriptionformat()

Get description format.

Return Value

int

at line 920
user with_descriptionformat(int $descriptionformat)

Set description format.

Parameters

int $descriptionformat

Return Value

user

at line 932
int get_mailformat()

Get mail format.

Return Value

int

at line 944
user with_mailformat(int $mailformat)

Set mail format.

Parameters

int $mailformat

Return Value

user

at line 956
int get_maildigest()

Get mail digest mode.

Return Value

int

at line 968
user with_maildigest(int $maildigest)

Set mail digest mode.

Parameters

int $maildigest

Return Value

user

at line 980
int get_maildisplay()

Get mail display preference.

Return Value

int

at line 992
user with_maildisplay(int $maildisplay)

Set mail display preference.

Parameters

int $maildisplay

Return Value

user

at line 1004
int get_autosubscribe()

Get autosubscribe preference.

Return Value

int

at line 1016
user with_autosubscribe(int $autosubscribe)

Set autosubscribe preference.

Parameters

int $autosubscribe

Return Value

user

at line 1028
int get_trackforums()

Get forums tracking preference.

Return Value

int

at line 1040
user with_trackforums(int $trackforums)

Set forums tracking preference.

Parameters

int $trackforums

Return Value

user

at line 1052
int get_trustbitmask()

Get trust bitmask.

Return Value

int

at line 1064
user with_trustbitmask(int $trustbitmask)

Set trust bitmask.

Parameters

int $trustbitmask

Return Value

user

at line 1076
string|null get_imagealt()

Get image alt text.

Return Value

string|null

at line 1088
user with_imagealt(string|null $imagealt)

Set image alt text.

Parameters

string|null $imagealt

Return Value

user

at line 1100
string|null get_lastnamephonetic()

Get lastname phonetic.

Return Value

string|null

at line 1112
user with_lastnamephonetic(string|null $lastnamephonetic)

Set lastname phonetic.

Parameters

string|null $lastnamephonetic

Return Value

user

at line 1124
string|null get_firstnamephonetic()

Get firstname phonetic.

Return Value

string|null

at line 1136
user with_firstnamephonetic(string|null $firstnamephonetic)

Set firstname phonetic.

Parameters

string|null $firstnamephonetic

Return Value

user

at line 1148
string|null get_middlename()

Get middle name.

Return Value

string|null

at line 1160
user with_middlename(string|null $middlename)

Set middle name.

Parameters

string|null $middlename

Return Value

user

at line 1172
string|null get_alternatename()

Get alternate name.

Return Value

string|null

at line 1184
user with_alternatename(string|null $alternatename)

Set alternate name.

Parameters

string|null $alternatename

Return Value

user

at line 1196
string|null get_moodlenetprofile()

Get MoodleNet profile.

Return Value

string|null

at line 1208
user with_moodlenetprofile(string|null $moodlenetprofile)

Set MoodleNet profile.

Parameters

string|null $moodlenetprofile

Return Value

user