class manager

Custom Profile Fields (CPF) manager.

Properties

protected auth $auth
protected db_text $config_text
protected driver_interface $db
protected tools $db_tools
protected dispatcher_interface $dispatcher
protected language $language
protected log $log
protected request $request
protected template $template
protected service_collection $type_collection
protected user $user
protected string $fields_table
protected string $fields_data_table
protected string $fields_data_lang_table
protected string $fields_lang_table
protected array $profile_cache

Methods

__construct(auth $auth, db_text $config_text, driver_interface $db, tools $db_tools, dispatcher_interface $dispatcher, language $language, log $log, request $request, template $template, service_collection $type_collection, user $user, string $fields_table, string $fields_data_table, string $fields_data_lang_table, string $fields_lang_table)

Construct

void
generate_profile_fields(string $mode, int $lang_id)

Assign editable fields to template.

void
build_cache()

Build profile cache, used for display.

submit_cp_field(string $mode, int $lang_id, array $cp_data, array $cp_error)

Submit profile field for validation.

update_profile_field_data(int $user_id, array $cp_data)

Update profile field data directly.

array
generate_profile_fields_template_headlines(string $restrict_option = '')

Generate the template arrays in order to display the column names.

array
grab_profile_fields_data(int|array $user_ids = 0)

Grab the user specific profile fields data.

array
generate_profile_fields_template_data(array $profile_row, bool $use_contact_fields = true)

Generate the user's profile fields data for the template.

array
build_insert_sql_array(array $cp_data)

Build array for the custom profile fields table.

disable_profilefields(string $type_name)

Disable all profile fields of a certain type.

purge_profilefields(string $type_name)

Purge all profile fields of a certain type.

enable_profilefields(string $type_name)

Enable the profile fields of a certain type.

Details

at line 88
__construct(auth $auth, db_text $config_text, driver_interface $db, tools $db_tools, dispatcher_interface $dispatcher, language $language, log $log, request $request, template $template, service_collection $type_collection, user $user, string $fields_table, string $fields_data_table, string $fields_data_lang_table, string $fields_lang_table)

Construct

Parameters

auth $auth

Auth object

db_text $config_text

Config_text object

driver_interface $db

Database object

tools $db_tools

Database tools object

dispatcher_interface $dispatcher

Event dispatcher object

language $language

Language object

log $log

Log object

request $request

Request object

template $template

Template object

service_collection $type_collection

CPF Type collection

user $user

User object

string $fields_table

CPF Table

string $fields_data_table

CPF Data table

string $fields_data_lang_table

CPF Data language table

string $fields_lang_table

CPF Language table

at line 133
void generate_profile_fields(string $mode, int $lang_id)

Assign editable fields to template.

Called by ucp_profile and ucp_register.

Parameters

string $mode

The mode (profile|register)

int $lang_id

The language identifier

Return Value

void

at line 193
protected void build_cache()

Build profile cache, used for display.

Return Value

void

at line 225
submit_cp_field(string $mode, int $lang_id, array $cp_data, array $cp_error)

Submit profile field for validation.

Parameters

string $mode

The mode (profile|register)

int $lang_id

The language identifier

array $cp_data

Custom profile field data

array $cp_error

Custom profile field errors

at line 290
update_profile_field_data(int $user_id, array $cp_data)

Update profile field data directly.

Parameters

int $user_id

The user identifier

array $cp_data

Custom profile field data

at line 319
array generate_profile_fields_template_headlines(string $restrict_option = '')

Generate the template arrays in order to display the column names.

Parameters

string $restrict_option

Restrict the published fields to a certain profile field option

Return Value

array

Returns an array with the template variables type, name and explain for the fields to display

at line 371
array grab_profile_fields_data(int|array $user_ids = 0)

Grab the user specific profile fields data.

Parameters

int|array $user_ids

Single user id or an array of ids

Return Value

array

Users profile fields data

at line 438
array generate_profile_fields_template_data(array $profile_row, bool $use_contact_fields = true)

Generate the user's profile fields data for the template.

Parameters

array $profile_row

Array with users profile field data

bool $use_contact_fields

Should we display contact fields as such? This requires special treatments: (links should not be parsed in the values, and more)

Return Value

array

The user's profile fields data

at line 541
array build_insert_sql_array(array $cp_data)

Build array for the custom profile fields table.

Parameters

array $cp_data

Custom profile field data

Return Value

array

Custom profile field data for SQL usage

at line 578
disable_profilefields(string $type_name)

Disable all profile fields of a certain type.

This should be called when an extension which has profile field types is disabled so that all those profile fields are hidden and do not cause errors.

Parameters

string $type_name

Type identifier of the profile fields

at line 614
purge_profilefields(string $type_name)

Purge all profile fields of a certain type.

This should be called when an extension which has profile field types is purged so that all those profile fields are removed.

Parameters

string $type_name

Type identifier of the profile fields

at line 680
enable_profilefields(string $type_name)

Enable the profile fields of a certain type.

This should be called when an extension which has profile field types that was disabled is re-enabled so that all those profile fields that were disabled are enabled again.

Parameters

string $type_name

Type identifier of the profile fields