User
class User extends Model
XELOS System User Model
Traits
Constants
EVENT_MODEL_AFTER_SAVE |
|
EVENT_MODEL_BEFORE_SAVE |
|
EVENT_MODEL_BEFORE_DELETE |
|
EVENT_MODEL_AFTER_DELETE |
|
FIELD_IS_NULL |
$this->find_by_field(Model::IS_NULL) |
Properties
Core | $mod | from Model | |
protected | $model_name | ||
$table_name | |||
protected | $table_use_group_id | ||
protected | $table_auto_properties | ||
protected string | $table_primary_key | from Model | |
protected array | $table_primary_compound_key | from Model | |
protected array | $properties | ATTENTION: Custom save handler - consider on setting properties to this model |
|
protected array | $properties_meta | from Model | |
protected array | $markers | from Model | |
protected array | $properties_null_values | from Model | |
bool|string | $class_name | from Model | |
string | $render_type | from Model | |
protected int | $model_version | Hint your model version, this parameter might affect certain outcomes and behaviours This version string is added for backwards compatibility |
from Model |
protected string | $model_default_render_xui | Defines a XUI helper which can be used to display this model in the render() function e.g. use 'thread' to use this xui helper "XELOS\Modules\Forum\UI\Thread" of the models parent module |
from Model |
protected array | $render_params | Parameters that will be consigned to the XUI helper |
from Model |
static string | $find_by_separators | from Model | |
bool | $loaded | from Model | |
bool | $saved | from Model | |
protected array | $changed | from Model | |
array | $cache_function_result | from Model | |
static array | $_request_cache | from Model | |
int | $last_login_error_count |
Methods
Magic Function Object Cloning Make sure object references are cleaned up as each object requires a clean and separate reference
No description
Calls the passed function only if it is not cached yet, otherwise the previous cached result will be returned
Global named scope scopeAll to use on models to return an unscoped unloaded collection
Called for scopeby Magic Function Creates a new ModelCollection and applies the passed scope
Called for scope_ Magic Function Creates a new ModelCollection and applies the passed custom scope function
Sets the users avatar picture
Apply lib->format multi_format on passed property. The result will be written to ->[property]_formatted
Add Audit Log entry
Adds a condition to scope the following find functions
Trigger user meta delete and set login, email null and shorten surname of an user
No description
Clears the cache for all functions or a specific one
Convert Assoc Multidimensional Array to Model Conditional Array
Returns the count of all models with the specific column value
Disables the user
Delete the user meta from the current user
on the desired collection.
Enable the verification for the passed fields The following save() call will trigger a new verification request and informs the user to confirm this change
Filter a given set of user_ids and returning only user_ids with matching status
Find Function to find models using the passed condition
Returns loaded ModelCollection
No description
No description
Find all users belonging to a certain security group, which are NOT disabled
Returns all models with a specific column value. Query params can be e.g. order_by
No description
No description
Converts a findby* function name to SQL query.
No description
Return properties which have been changed after model was initialized/loaded We know these values have been changed locally, but these changes are NOT necessarily reflecting the DB diff
No description
Return a new unscoped model collection for further processing
Returns the Query object which is being used for building the query The function creates a new Query object if required to enable lazy loading
Returns the WHERE SQL Conditions based on the current Condition Separate function to be able to update scopes at this point in time if needed
Return properties which have been touched/set after model was initialized/loaded We know these values have been set, but they might not have changed
Returns the URL for the user avatar
Returns the current online status of the current user
Returns all properties which are available as DB field (= can be used as find_by() properties) with its currently known raw value Please note that smartTimeFields (updated_at, created_at) are not converted to mysql-date format
No description
Return Language like $culture_only false = "EN_GB" $culture_only true = "GB"
Return the property translated property value if available
Returns the SQL table of this model (if available)
Returns a list of available status types incl. label
put your comment there.
Returns the complete properties array
No description
Returns an array with a short user profile depending on the installed helpers and modules the source can be e.g. system profile or lookbook
No description
No description
No description
No description
No description
Returns an array with all user links for the selected user
Check if User is in a specific group
No description
Returns true if the current user is online
No description
No description
No description
Parse Template for User Properties
No description
No description
Execute Query of find() function. Can be modified by child class if necessary
Registers the passed scope as default scope A default scope is present when the model is being loaded and can be removed using the unscope() function if required The passed scope must be defined in a scope[SCOPE_NAME] function e.g. scopeGroupId
No description
Generic Renderer
No description
No description
Save properties which require verification
Provides a list of all values allowed for enumerations.
Returns unloaded ModelCollection
No description
If old_password_check propert is filled the new_password() change will only be triggered if the passed value matches the old password and the model will not validate
No description
Set user property
Sets parameter that will be passed to the XUI helpers
No description
Set a Userconfig Setting
Sort this element to a specific position
Decrease Sort Priority (Increases SORT value)
Increase Sort Priority (Decreases SORT value)
Temporarily disable the use of the group ID in all queries made
Temporarily enables the use of the group ID in all queries made
Returns an XML of all model properties
Removes all scopes (including Default Scopes)
Update the sort property for a given table (Move a record up/down)
Validate User Model Changes
Details
in
Model at line 994
ModelCollection|Model|Model[]|int
__call(string $method, array $args = array())
No description
in
Model at line 1544
__clone()
Magic Function Object Cloning Make sure object references are cleaned up as each object requires a clean and separate reference
at line 120
__construct(int|bool $id = false)
No description
in
Model at line 963
mixed
__get(mixed $var)
No description
in
Model at line 1601
__isset($name)
No description
in
Model at line 976
mixed
__set(mixed $var, mixed $value)
No description
in
Model at line 1553
string
__toString()
String Representation of this object (calls for render method)
in
Model at line 1032
mixed
_call_cached_function(string $function, array $args)
Calls the passed function only if it is not cached yet, otherwise the previous cached result will be returned
in
ScopesTrait at line 81
Query
_scopeAll(Query $Query)
Global named scope scopeAll to use on models to return an unscoped unloaded collection
in
ScopesTrait at line 90
Query
_scopeDefault(Query $Query)
Load default scopes
in
ScopesTrait at line 119
protected ModelCollection
_scope_by(mixed $fn, mixed $parameters)
Called for scopeby Magic Function Creates a new ModelCollection and applies the passed scope
in
ScopesTrait at line 132
protected ModelCollection
_scope_custom(mixed $fn)
Called for scope_ Magic Function Creates a new ModelCollection and applies the passed custom scope function
at line 874
string|null
add_avatar_image(string $file, string|bool $file_type = false)
Sets the users avatar picture
in
Model at line 823
add_formatted_property(string $property, string $format, array $options = array())
Apply lib->format multi_format on passed property. The result will be written to ->[property]_formatted
at line 590
int
add_log(string $message, int $source_user = null, int $time = null)
Add Audit Log entry
in
ScopesTrait at line 32
ModelCollection
add_scope_condition(Condition|Query|string $new_condition)
Adds a condition to scope the following find functions
in
Model at line 36
Model[]
all(mixed $params = ['order_by'=>'COL1)
Return all models
at line 1390
anonymize()
Trigger user meta delete and set login, email null and shorten surname of an user
at line 407
void
assign_security_group(string $security_group)
No description
in
Model at line 1051
clear_cached_functions(string|bool $function = false)
Clears the cache for all functions or a specific one
in
Model at line 567
clear_properties()
No description
in
Model at line 1228
array
convert_array_to_conditions(array $params = array())
Convert Assoc Multidimensional Array to Model Conditional Array
in
Model at line 36
int
count_all()
Returns the count of all models
in
Model at line 36
Model[]
count_by_TABLE_COL_and_TABLE_COL2(mixed $COL1_VALUE, mixed $COL2_VALUE)
Returns the count of all models with the specific column value
in
Model at line 808
string|void
debug(bool $show_markers = false, int $mode = 0)
No description
at line 1422
bool
delete()
Disables the user
at line 1409
deleteUserMeta()
Delete the user meta from the current user
in
Model at line 36
int
delete_by_TABLE_COL(mixed $COL_VALUE) Delete rows specified by condition and returns the affected rows. NOTE: This does not trigger a delete() function of the model. If required use pluck('delete')
on the desired collection.
in
Model at line 1497
void
disable_table_group_id()
Disable the use of the group ID in all queries made
at line 297
enable_field_verification($field_array, bool|string $show_flash_message = false)
internal | param $array |
Enable the verification for the passed fields The following save() call will trigger a new verification request and informs the user to confirm this change
in
Model at line 1520
void
enable_table_group_id()
Enable the use of the group ID in all queries made
at line 373
array
filter_user_ids_by_status(array $user_ids, array|string $status = ['active', 'no_login'])
Filter a given set of user_ids and returning only user_ids with matching status
in
Model at line 1094
mixed
find(string $mode = 'all', mixed $conditions = false, mixed $query_params = false)
Find Function to find models using the passed condition
in
Model at line 36
ModelCollection|Model[]
find_all_by_TABLE_COL_and_TABLE_COL2($COL1_VALUE, $COL2_VALUE, $params=['order_by'=>'COL1, 5]] $)
Returns loaded ModelCollection
at line 40
ModelCollection
find_all_by_displayname(mixed $name)
No description
at line 40
ModelCollection
find_all_by_id(mixed $id, mixed $query_params))
No description
at line 1474
ModelCollection
find_all_by_user_group(string|int $security_group, int $group_security_id = 0)
Find all users belonging to a certain security group, which are NOT disabled
in
Model at line 36
Model
find_by_TABLE_COL(mixed $COL_VALUE, mixed $params = ['order_by'=>'COL1)
Returns all models with a specific column value. Query params can be e.g. order_by
at line 40
User
find_by_id(int $user_id)
No description
at line 40
User
find_by_login(string $login)
No description
in
Model at line 1286
Query
functionNameToQuery(string $query, array $parameters)
Converts a findby* function name to SQL query.
at line 187
mixed
get($var)
No description
in
Model at line 1685
array
getChangedProperties(bool $returnOldValues = false)
Return properties which have been changed after model was initialized/loaded We know these values have been changed locally, but these changes are NOT necessarily reflecting the DB diff
in
Model at line 839
ModelCollection
getCollectionByQuery(string $model_name, array|string $dbquery_result, string $population_mode = 'full', string $post_fill_function = 'update')
No description
in
Model at line 187
array
getDBSchema()
Get DB Schema if available
in
Model at line 1066
ModelCollection
getModelCollection()
Return a new unscoped model collection for further processing
in
Model at line 450
array
getPropertyMarkers(bool $value_discovery = true)
Return properties and markers
in
ScopesTrait at line 212
Query
getScopeQuery()
Returns the Query object which is being used for building the query The function creates a new Query object if required to enable lazy loading
in
ScopesTrait at line 202
protected string
getScopeQueryConditionSQL()
Returns the WHERE SQL Conditions based on the current Condition Separate function to be able to update scopes at this point in time if needed
in
Model at line 1666
array
getTouchedProperties(bool $returnOldValues = false)
Return properties which have been touched/set after model was initialized/loaded We know these values have been set, but they might not have changed
at line 1115
string
get_avatar_url(int|string|bool $width = 'auto', int|string|bool $height = 'auto')
Returns the URL for the user avatar
in
Model at line 1472
string
get_created_at_formatted()
Return a Formatted DateTime
at line 1359
string
get_current_online_status()
Returns the current online status of the current user
in
Model at line 479
array
get_db_properties()
Returns all properties which are available as DB field (= can be used as find_by() properties) with its currently known raw value Please note that smartTimeFields (updated_at, created_at) are not converted to mysql-date format
at line 453
get_fullname()
No description
at line 1445
string
get_i18n_language(bool $culture_only = false, bool $fallback_language = true)
Return Language like $culture_only false = "EN_GB" $culture_only true = "GB"
in
Model at line 1642
bool|mixed
get_i18n_property(string $property, string $force_language = false)
Return the property translated property value if available
in
Model at line 317
string
get_model_name()
Returns the SQL table of this model (if available)
in
Model at line 296
string|bool
get_model_table_name(string $table_name = null)
Returns the SQL table of this model (if available)
at line 1378
get_online_status_mapping()
Returns a list of available status types incl. label
at line 965
get_portrait_url(int $width = 'auto', int $height = 'auto')
put your comment there.
..
at line 251
array
get_properties(bool $value_discovery = true)
Returns the complete properties array
in
Model at line 466
array
get_properties_meta(bool|string $field = false)
No description
at line 191
mixed
get_property(string $property_id, bool $get_raw_value = false)
No description
in
Model at line 1630
static mixed|null
get_request_cache(string $key)
Return Cache Entry if it exists
at line 704
array
get_short_profile(string $profile_type = false, int $image_width = false, int $image_height = false)
Returns an array with a short user profile depending on the installed helpers and modules the source can be e.g. system profile or lookbook
in
Model at line 287
string
get_table_name()
Returns the table name of this model.
in
Model at line 309
string
get_table_primary_key()
No description
in
Model at line 1481
string
get_updated_at_formatted()
Return a Formatted DateTime
at line 1301
int[]
get_user_groups(bool $force_reload = false)
No description
at line 461
int
get_user_id()
No description
at line 359
array
get_user_ids_by_security_group(int $system_group_id, array|string $status = ['active', 'no_login'])
No description
at line 848
bool|mixed|string
get_user_pic(string $pic_type = null, int|string $width = 'auto', int|string $height = 'auto')
No description
at line 798
mixed
get_user_setting($var, string $instance_id = 'GLOBAL')
No description
at line 1181
array
get_userlinks()
Returns an array with all user links for the selected user
in
Model at line 1696
bool
hasChangedProperties()
No description
in
Model at line 1673
bool
hasTouchedProperties()
No description
at line 1315
bool
in_group($group_id)
Check if User is in a specific group
at line 140
init(bool $auto_load = true)
No description
at line 1332
is_online()
Returns true if the current user is online
qreturn bool online
in
Model at line 355
load()
No description
in
Model at line 698
protected bool
load_from_db(string $table_name, array|bool $key_fields = false)
No description
at line 261
load_meta()
No description
at line 274
load_unverified()
No description
at line 1270
protected
load_user_groups()
No description
at line 661
string
parse_template(string $template, bool $urlencode = false)
Parse Template for User Properties
at line 666
parse_template_cb($matches)
No description
in
Model at line 932
ModelCollection|Model[]
populate_model_by_query(string $model_name, array|string $dbquery_result, string $population_mode = 'full', string $post_fill_function = 'update')
deprecated
deprecated
No description
in
Model at line 1246
protected array
process_find_query(mixed $select_field, mixed $query_params)
Execute Query of find() function. Can be modified by child class if necessary
in
ScopesTrait at line 105
protected void
registerDefaultScope($scopeName)
Registers the passed scope as default scope A default scope is present when the model is being loaded and can be removed using the unscope() function if required The passed scope must be defined in a scope[SCOPE_NAME] function e.g. scopeGroupId
in
Model at line 160
reload_schema()
Reloads the schema of the model
in
Model at line 773
protected bool
remove_from_db(string $table_name, array $key_fields = null)
No description
at line 428
void
remove_security_group(string $security_group)
No description
at line 1430
null
render()
Generic Renderer
at line 468
int|bool
save($change_message = false)
No description
at line 305
save_meta()
No description
in
Model at line 584
protected int|bool
save_to_db(string $table_name, array $params = array())
No description
at line 328
save_unverified()
Save properties which require verification
in
Model at line 1266
bool|array
schema_values(mixed $field_name)
Provides a list of all values allowed for enumerations.
Returns FALSE if the field in question does not exist Returns TRUE for non enum fields Returns an array for enum fields with all available values
in
ScopesTrait at line 14
ModelCollection
scopeAll()
No description
in
Model at line 36
Model[]
scope_by_TABLE_COL_and_TABLE_COL2(mixed $COL1_VALUE, mixed $COL2_VALUE)
Returns unloaded ModelCollection
in
Model at line 36
void
self() $this find_by_id($id)
No description
at line 449
set($var, $value)
No description
in
ScopesTrait at line 71
void
setModelCollectionReference(ModelCollection $modelCollectionReference)
No description
at line 1201
bool
set_current_password_check(string $old_password)
If old_password_check propert is filled the new_password() change will only be triggered if the passed value matches the old password and the model will not validate
at line 1234
string
set_new_password(null $new_password = null, int $force_password_change = 0, bool $silent = false)
No description
in
Model at line 550
void
set_properties_from_array(array $input, array|bool $filter = false)
No description
at line 209
set_property(string|array $property_id, string|bool $property_value = false, bool $no_change = false)
Set user property
in
Model at line 1574
set_render_params(mixed $params = array())
Sets parameter that will be passed to the XUI helpers
in
Model at line 1614
static
set_request_cache(string $key, mixed $value)
Set Request Cache Entry
at line 386
void
set_security_group(mixed $security_groups)
No description
at line 834
bool
set_user_setting(mixed $variable, mixed $value, mixed $instance_id = false, mixed $module_name = false)
Set a Userconfig Setting
in
SortTrait at line 116
void
sortMoveTo(int $id, int $sortTo, array|null $conditions = [])
Sort this element to a specific position
in
SortTrait at line 28
sort_down(int $steps = 1, $params = array())
Decrease Sort Priority (Increases SORT value)
in
SortTrait at line 17
sort_up(int $steps = 1, $params = array())
Increase Sort Priority (Decreases SORT value)
in
Model at line 1536
stop_temporary_group_id_overwrite()
Stops the temporary overwrite of the table_group_id
in
Model at line 1511
void
temporarily_disable_table_group_id()
Temporarily disable the use of the group ID in all queries made
in
Model at line 1528
void
temporarily_enable_table_group_id()
Temporarily enables the use of the group ID in all queries made
in
Model at line 1444
string
to_json()
Returns the model as JSON array
in
Model at line 1455
string
to_string()
Returns the model as STRING
in
Model at line 1397
string
to_xml(array|bool $property_filter = false, bool|DOMDocument $doc = false, DOMElement $parent_element = null)
Returns an XML of all model properties
in
ScopesTrait at line 49
ModelCollection
unscope($scopeName = false)
Removes all scopes (including Default Scopes)
in
SortTrait at line 43
protected int
update_sort(mixed $id = false, string $direction = 'up', int $steps = 1, array $params = array())
Update the sort property for a given table (Move a record up/down)
at line 1216
string|true
validate(array $fieldErrors)
Validate User Model Changes