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 37
mixed __get(string $name)

Magic getter to allow reading protected properties.

Parameters

string $name

Property name

Return Value

mixed

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

Magic isset to allow checking protected properties.

Parameters

string $name

Property name

Return Value

bool

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

Magic setter.

Parameters

string $name

Property name

mixed $value Value

Return Value

void

in abstract_entity at line 78
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 118
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 128
string get_fullname()

Helper to get fullname.

Return Value

string

at line 138
string get_auth()

Get authentication plugin.

Return Value

string

at line 150
user with_auth(string $auth)

Set authentication plugin.

Parameters

string $auth

Return Value

user

at line 162
int get_confirmed()

Get confirmation flag.

Return Value

int

at line 174
user with_confirmed(int $confirmed)

Set confirmation flag.

Parameters

int $confirmed

Return Value

user

at line 186
int get_policyagreed()

Get policy agreement flag.

Return Value

int

at line 198
user with_policyagreed(int $policyagreed)

Set policy agreement flag.

Parameters

int $policyagreed

Return Value

user

at line 210
int get_deleted()

Get deleted flag.

Return Value

int

at line 222
user with_deleted(int $deleted)

Set deleted flag.

Parameters

int $deleted

Return Value

user

at line 234
int get_suspended()

Get suspended flag.

Return Value

int

at line 246
user with_suspended(int $suspended)

Set suspended flag.

Parameters

int $suspended

Return Value

user

at line 258
int get_mnethostid()

Get MNet host identifier.

Return Value

int

at line 270
user with_mnethostid(int $mnethostid)

Set MNet host identifier.

Parameters

int $mnethostid

Return Value

user

at line 282
string get_username()

Get username.

Return Value

string

at line 294
user with_username(string $username)

Set username.

Parameters

string $username

Return Value

user

at line 306
string get_password()

Get hashed password.

Return Value

string

at line 318
user with_password(string $password)

Set hashed password.

Parameters

string $password

Return Value

user

at line 330
string get_idnumber()

Get idnumber.

Return Value

string

at line 342
user with_idnumber(string $idnumber)

Set idnumber.

Parameters

string $idnumber

Return Value

user

at line 354
string get_firstname()

Get first name.

Return Value

string

at line 366
user with_firstname(string $firstname)

Set first name.

Parameters

string $firstname

Return Value

user

at line 378
string get_lastname()

Get last name.

Return Value

string

at line 390
user with_lastname(string $lastname)

Set last name.

Parameters

string $lastname

Return Value

user

at line 402
string get_email()

Get email.

Return Value

string

at line 414
user with_email(string $email)

Set email.

Parameters

string $email

Return Value

user

at line 426
int get_emailstop()

Get email stop flag.

Return Value

int

at line 438
user with_emailstop(int $emailstop)

Set email stop flag.

Parameters

int $emailstop

Return Value

user

at line 450
string get_phone1()

Get primary phone.

Return Value

string

at line 462
user with_phone1(string $phone1)

Set primary phone.

Parameters

string $phone1

Return Value

user

at line 474
string get_phone2()

Get secondary phone.

Return Value

string

at line 486
user with_phone2(string $phone2)

Set secondary phone.

Parameters

string $phone2

Return Value

user

at line 498
string get_institution()

Get institution.

Return Value

string

at line 510
user with_institution(string $institution)

Set institution.

Parameters

string $institution

Return Value

user

at line 522
string get_department()

Get department.

Return Value

string

at line 534
user with_department(string $department)

Set department.

Parameters

string $department

Return Value

user

at line 546
string get_address()

Get address.

Return Value

string

at line 558
user with_address(string $address)

Set address.

Parameters

string $address

Return Value

user

at line 570
string get_city()

Get city.

Return Value

string

at line 582
user with_city(string $city)

Set city.

Parameters

string $city

Return Value

user

at line 594
string get_country()

Get country code.

Return Value

string

at line 606
user with_country(string $country)

Set country code.

Parameters

string $country

Return Value

user

at line 618
string get_lang()

Get language.

Return Value

string

at line 630
user with_lang(string $lang)

Set language.

Parameters

string $lang

Return Value

user

at line 642
string get_calendartype()

Get calendar type.

Return Value

string

at line 654
user with_calendartype(string $calendartype)

Set calendar type.

Parameters

string $calendartype

Return Value

user

at line 666
string get_theme()

Get theme.

Return Value

string

at line 678
user with_theme(string $theme)

Set theme.

Parameters

string $theme

Return Value

user

at line 690
string get_timezone()

Get timezone.

Return Value

string

at line 702
user with_timezone(string $timezone)

Set timezone.

Parameters

string $timezone

Return Value

user

at line 714
int get_firstaccess()

Get first access timestamp.

Return Value

int

at line 726
user with_firstaccess(int $firstaccess)

Set first access timestamp.

Parameters

int $firstaccess

Return Value

user

at line 738
int get_lastaccess()

Get last access timestamp.

Return Value

int

at line 750
user with_lastaccess(int $lastaccess)

Set last access timestamp.

Parameters

int $lastaccess

Return Value

user

at line 762
int get_lastlogin()

Get last login timestamp.

Return Value

int

at line 774
user with_lastlogin(int $lastlogin)

Set last login timestamp.

Parameters

int $lastlogin

Return Value

user

at line 786
int get_currentlogin()

Get current login timestamp.

Return Value

int

at line 798
user with_currentlogin(int $currentlogin)

Set current login timestamp.

Parameters

int $currentlogin

Return Value

user

at line 810
string get_lastip()

Get last IP.

Return Value

string

at line 822
user with_lastip(string $lastip)

Set last IP.

Parameters

string $lastip

Return Value

user

at line 834
string get_secret()

Get secret string.

Return Value

string

at line 846
user with_secret(string $secret)

Set secret string.

Parameters

string $secret

Return Value

user

at line 858
int get_picture()

Get picture revision.

Return Value

int

at line 870
user with_picture(int $picture)

Set picture revision.

Parameters

int $picture

Return Value

user

at line 882
string|null get_description()

Get description.

Return Value

string|null

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

Set description.

Parameters

string|null $description

Return Value

user

at line 906
int get_descriptionformat()

Get description format.

Return Value

int

at line 918
user with_descriptionformat(int $descriptionformat)

Set description format.

Parameters

int $descriptionformat

Return Value

user

at line 930
int get_mailformat()

Get mail format.

Return Value

int

at line 942
user with_mailformat(int $mailformat)

Set mail format.

Parameters

int $mailformat

Return Value

user

at line 954
int get_maildigest()

Get mail digest mode.

Return Value

int

at line 966
user with_maildigest(int $maildigest)

Set mail digest mode.

Parameters

int $maildigest

Return Value

user

at line 978
int get_maildisplay()

Get mail display preference.

Return Value

int

at line 990
user with_maildisplay(int $maildisplay)

Set mail display preference.

Parameters

int $maildisplay

Return Value

user

at line 1002
int get_autosubscribe()

Get autosubscribe preference.

Return Value

int

at line 1014
user with_autosubscribe(int $autosubscribe)

Set autosubscribe preference.

Parameters

int $autosubscribe

Return Value

user

at line 1026
int get_trackforums()

Get forums tracking preference.

Return Value

int

at line 1038
user with_trackforums(int $trackforums)

Set forums tracking preference.

Parameters

int $trackforums

Return Value

user

at line 1050
int get_trustbitmask()

Get trust bitmask.

Return Value

int

at line 1062
user with_trustbitmask(int $trustbitmask)

Set trust bitmask.

Parameters

int $trustbitmask

Return Value

user

at line 1074
string|null get_imagealt()

Get image alt text.

Return Value

string|null

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

Set image alt text.

Parameters

string|null $imagealt

Return Value

user

at line 1098
string|null get_lastnamephonetic()

Get lastname phonetic.

Return Value

string|null

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

Set lastname phonetic.

Parameters

string|null $lastnamephonetic

Return Value

user

at line 1122
string|null get_firstnamephonetic()

Get firstname phonetic.

Return Value

string|null

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

Set firstname phonetic.

Parameters

string|null $firstnamephonetic

Return Value

user

at line 1146
string|null get_middlename()

Get middle name.

Return Value

string|null

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

Set middle name.

Parameters

string|null $middlename

Return Value

user

at line 1170
string|null get_alternatename()

Get alternate name.

Return Value

string|null

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

Set alternate name.

Parameters

string|null $alternatename

Return Value

user

at line 1194
string|null get_moodlenetprofile()

Get MoodleNet profile.

Return Value

string|null

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

Set MoodleNet profile.

Parameters

string|null $moodlenetprofile

Return Value

user