Elgg  Version 4.3
Functions
deprecated-4.3.php File Reference

Go to the source code of this file.

Functions

 get_access_array (int $user_guid=0)
 Bundle all functions which have been deprecated in Elgg 4.3. More...
 
 get_default_access (ElggUser $user=null, array $input_params=[])
 Gets the default access permission. More...
 
 has_access_to_entity (\ElggEntity $entity,\ElggUser $user=null)
 Can a user access an entity. More...
 
 get_write_access_array (int $user_guid=0, $ignored=0, bool $flush=false, array $input_params=[])
 Returns an array of access permissions that the user is allowed to save content with. More...
 
 can_edit_access_collection (int $collection_id, int $user_guid=null)
 Can the user change this access collection? More...
 
 create_access_collection (string $name, int $owner_guid=0, $subtype=null)
 Creates a new access collection. More...
 
 delete_access_collection (int $collection_id)
 Deletes a specified access collection and its membership. More...
 
 get_access_collection (int $collection_id)
 Get a specified access collection. More...
 
 add_user_to_access_collection (int $user_guid, int $collection_id)
 Adds a user to an access collection. More...
 
 remove_user_from_access_collection (int $user_guid, int $collection_id)
 Removes a user from an access collection. More...
 
 get_members_of_access_collection (int $collection_id, bool $guids_only=false, array $options=[])
 Get all of members of an access collection. More...
 
 get_readable_access_level (int $entity_access_id)
 Return the name of an ACCESS_* constant or an access collection, but only if the logged in user has write access to it. More...
 
 get_entity_statistics (int $owner_guid=0)
 Return an array reporting the number of various entities in the system. More...
 
 get_relationship ($id)
 Get a relationship by its ID. More...
 
 delete_relationship ($id)
 Delete a relationship by its ID. More...
 
 add_entity_relationship ($guid_one, $relationship, $guid_two)
 Create a relationship between two entities. More...
 
 check_entity_relationship ($guid_one, $relationship, $guid_two)
 Check if a relationship exists between two entities. More...
 
 remove_entity_relationship ($guid_one, $relationship, $guid_two)
 Delete a relationship between two entities. More...
 
 remove_entity_relationships ($guid, $relationship="", $inverse_relationship=false, $type= '')
 Removes all relationships originating from a particular entity. More...
 
 get_entity_relationships ($guid, $inverse_relationship=false)
 Get all the relationships for a given GUID. More...
 
 register_pam_handler ($handler, $importance= 'sufficient', $policy= 'user')
 Register a PAM handler. More...
 
 unregister_pam_handler ($handler, $policy= 'user')
 Unregisters a PAM handler. More...
 
 elgg_authenticate ($username, $password)
 Perform user authentication with a given username and password. More...
 
 generate_invite_code ($username)
 Generates a unique invite code for a user. More...
 
 elgg_get_loaded_external_files (string $type, string $location)
 Get external resource descriptors. More...
 
 get_dir_size ($dir, $total_size=0, $show_deprecation_notice=true)
 Get the size of the specified directory. More...
 
 filter_tags ($var)
 Filter tags from a given string based on registered hooks. More...
 
 parse_urls ($text)
 Takes a string and turns any URLs into formatted links. More...
 
 current_page_url ()
 Returns the current page's complete URL. More...
 
 is_email_address ($address)
 Validates an email address. More...
 
 string_to_tag_array ($string)
 Takes in a comma-separated string and returns an array of tags which have been trimmed. More...
 
 add_translation ($country_code, $language_array)
 Add a translation. More...
 
 get_current_language ()
 Get the current system/user language or "en". More...
 
 logout ()
 Log the current user out. More...
 
 login (\ElggUser $user, $persistent=false)
 Logs in a specified . More...
 
 log_login_failure ($user_guid)
 Log a failed login for $user_guid. More...
 
 reset_login_failure_count ($user_guid)
 Resets the fail login count for $user_guid. More...
 
 check_rate_limit_exceeded ($user_guid)
 Checks if the rate limit of failed logins has been exceeded for $user_guid. More...
 
 find_active_users (array $options=[])
 Return users (or the number of them) who have been active within a recent period. More...
 
 get_online_users (array $options=[])
 Render a list of currently online users. More...
 
 generate_random_cleartext_password ()
 Generate a random 12 character clear text password. More...
 
 force_user_password_reset ($user_guid, $password)
 Low level function to reset a given user's password. More...
 
 send_new_password_request ($user_guid)
 Generate and send a password request email to a given user's registered email address. More...
 
 execute_new_password_request ($user_guid, $conf_code, $password=null)
 Validate and change password for a user. More...
 
 register_user ($username, $password, $name, $email, $allow_multiple_emails=false, $subtype=null, array $params=[])
 Registers a user, returning false if the username already exists. More...
 
 elgg_get_engine_path ()
 /path/to/elgg/engine with no trailing slash. More...
 
 elgg_delete_metadata_by_id ($id)
 Deletes metadata using its ID. More...
 
 elgg_clear_sticky_value ($form_name, $variable)
 Remove one value of form submission data from the session. More...
 
 elgg_register_external_view ($view, $cacheable=false)
 Registers a view as being available externally (i.e. More...
 
 elgg_unregister_external_view ($view)
 Unregister a view for ajax calls. More...
 

Function Documentation

add_entity_relationship (   $guid_one,
  $relationship,
  $guid_two 
)

Create a relationship between two entities.

E.g. friendship, group membership, site membership.

This function lets you make the statement "$guid_one is a $relationship of $guid_two". In the statement, $guid_one is the subject of the relationship, $guid_two is the target, and $relationship is the type.

Parameters
int$guid_oneGUID of the subject entity of the relationship
string$relationshipType of the relationship
int$guid_twoGUID of the target entity of the relationship
Returns
bool
Exceptions

Definition at line 326 of file deprecated-4.3.php.

add_translation (   $country_code,
  $language_array 
)

Add a translation.

Translations are arrays in the Zend Translation array format, eg:

$english = array('message1' => 'message1', 'message2' => 'message2'); $german = array('message1' => 'Nachricht1','message2' => 'Nachricht2');

Parameters
string$country_codeStandard country code (eg 'en', 'nl', 'es')
array$language_arrayFormatted array of strings
Returns
bool Depending on success

Definition at line 631 of file deprecated-4.3.php.

add_user_to_access_collection ( int  $user_guid,
int  $collection_id 
)

Adds a user to an access collection.

Triggers the 'access:collections:add_user', 'collection' plugin hook.

Parameters
int$user_guidThe GUID of the user to add
int$collection_idThe ID of the collection to add them to
Returns
bool

Definition at line 195 of file deprecated-4.3.php.

can_edit_access_collection ( int  $collection_id,
int  $user_guid = null 
)

Can the user change this access collection?

Use the plugin hook of 'access:collections:write', 'user' to change this.

See also
elgg_get_write_access_array() for details on the hook.

Respects access control disabling for admin users and elgg_call()

See also
elgg_get_write_access_array()
Parameters
int$collection_idThe collection id
mixed$user_guidThe user GUID to check for. Defaults to logged in user.
Returns
bool

Definition at line 120 of file deprecated-4.3.php.

check_entity_relationship (   $guid_one,
  $relationship,
  $guid_two 
)

Check if a relationship exists between two entities.

If so, the relationship object is returned.

This function lets you ask "Is $guid_one a $relationship of $guid_two?"

Parameters
int$guid_oneGUID of the subject entity of the relationship
string$relationshipType of the relationship
int$guid_twoGUID of the target entity of the relationship
Returns
|false Depending on success

Definition at line 344 of file deprecated-4.3.php.

check_rate_limit_exceeded (   $user_guid)

Checks if the rate limit of failed logins has been exceeded for $user_guid.

Parameters
int$user_guidUser GUID
Returns
bool on exceeded limit.

Definition at line 743 of file deprecated-4.3.php.

create_access_collection ( string  $name,
int  $owner_guid = 0,
  $subtype = null 
)

Creates a new access collection.

Access colletions allow plugins and users to create granular access for entities.

Triggers plugin hook 'access:collections:addcollection', 'collection'

Note
Internal: Access collections are stored in the access_collections table. Memberships to collections are in access_collections_membership.
Parameters
string$nameThe name of the collection.
int$owner_guidThe GUID of the owner (default: currently logged in user).
string$subtypeThe subtype indicates the usage of the acl
Returns
int|false The collection ID if successful and false on failure.

Definition at line 144 of file deprecated-4.3.php.

current_page_url ( )

Returns the current page's complete URL.

It uses the configured site URL for the hostname rather than depending on what the server uses to populate $_SERVER.

Returns
string The current page URL.

Definition at line 575 of file deprecated-4.3.php.

delete_access_collection ( int  $collection_id)

Deletes a specified access collection and its membership.

Parameters
int$collection_idThe collection ID
Returns
bool
See also
elgg_create_access_collection()

Definition at line 159 of file deprecated-4.3.php.

delete_relationship (   $id)

Delete a relationship by its ID.

Parameters
int$idThe relationship ID
Returns
bool

Definition at line 306 of file deprecated-4.3.php.

elgg_authenticate (   $username,
  $password 
)

Perform user authentication with a given username and password.

Warning
This returns an error message on failure. Use the identical operator to check for access: if (true === elgg_authenticate()) { ... }.
See also
login()
Parameters
string$usernameThe username
string$passwordThe password
Returns
true|string True or an error message on failure

Definition at line 456 of file deprecated-4.3.php.

elgg_clear_sticky_value (   $form_name,
  $variable 
)

Remove one value of form submission data from the session.

Parameters
string$form_nameThe name of the form
string$variableThe name of the variable to clear
Returns
void
Since
1.8.0

Definition at line 938 of file deprecated-4.3.php.

elgg_delete_metadata_by_id (   $id)

Deletes metadata using its ID.

Parameters
int$idThe metadata ID to delete.
Returns
bool

Definition at line 918 of file deprecated-4.3.php.

elgg_get_engine_path ( )

/path/to/elgg/engine with no trailing slash.

Returns
string

Definition at line 904 of file deprecated-4.3.php.

elgg_get_loaded_external_files ( string  $type,
string  $location 
)

Get external resource descriptors.

Parameters
string$typeType of file: js or css
string$locationPage location
Returns
array
Since
1.8.0

Definition at line 494 of file deprecated-4.3.php.

elgg_register_external_view (   $view,
  $cacheable = false 
)

Registers a view as being available externally (i.e.

via URL).

Parameters
string$viewThe name of the view.
boolean$cacheableWhether this view can be cached.
Returns
void
Since
1.9.0

Definition at line 954 of file deprecated-4.3.php.

elgg_unregister_external_view (   $view)

Unregister a view for ajax calls.

Parameters
string$viewThe view name
Returns
void
Since
1.9.0

Definition at line 973 of file deprecated-4.3.php.

execute_new_password_request (   $user_guid,
  $conf_code,
  $password = null 
)

Validate and change password for a user.

Parameters
int$user_guidThe user id
string$conf_codeConfirmation code as sent in the request email.
string$passwordOptional new password, if not randomly generated.
Returns
bool True on success

Definition at line 853 of file deprecated-4.3.php.

filter_tags (   $var)

Filter tags from a given string based on registered hooks.

Parameters
mixed$varAnything that does not include an object (strings, ints, arrays) This includes multi-dimensional arrays.
Returns
mixed The filtered result - everything will be strings

Definition at line 544 of file deprecated-4.3.php.

find_active_users ( array  $options = [])

Return users (or the number of them) who have been active within a recent period.

Parameters
array$optionsArray of options with keys: seconds (int) => Length of period (default 600 = 10min) limit (int) => Limit (default from settings) offset (int) => Offset (default 0) count (bool) => Return a count instead of users? (default false)
Returns
[]|int

Definition at line 772 of file deprecated-4.3.php.

force_user_password_reset (   $user_guid,
  $password 
)

Low level function to reset a given user's password.

Parameters
int$user_guidThe user.
string$passwordText (which will then be converted into a hash and stored)
Returns
bool

Definition at line 821 of file deprecated-4.3.php.

generate_invite_code (   $username)

Generates a unique invite code for a user.

Parameters
string$usernameThe username of the user sending the invitation
Returns
string Invite code
See also
elgg_validate_invite_code()

Definition at line 478 of file deprecated-4.3.php.

generate_random_cleartext_password ( )

Generate a random 12 character clear text password.

Returns
string

Definition at line 805 of file deprecated-4.3.php.

get_access_array ( int  $user_guid = 0)

Bundle all functions which have been deprecated in Elgg 4.3.

Returns an array of access IDs a user is permitted to see.

Can be overridden with the 'access:collections:read', 'user' plugin hook.

Warning
A callback for that plugin hook needs to either not retrieve data from the database that would use the access system (triggering the plugin again) or ignore the second call. Otherwise, an infinite loop will be created.

This returns a list of all the collection ids a user owns or belongs to plus public and logged in access levels. If the user is an admin, it includes the private access level.

See also
elgg_get_write_access_array() for the access levels that a user can write to.
Parameters
int$user_guidUser ID; defaults to currently logged in user
Returns
array An array of access collections ids

Definition at line 25 of file deprecated-4.3.php.

get_access_collection ( int  $collection_id)

Get a specified access collection.

Note
This doesn't return the members of an access collection, just the database row of the actual collection.
See also
get_members_of_access_collection()
Parameters
int$collection_idThe collection ID
Returns
ElggAccessCollection|false

Definition at line 178 of file deprecated-4.3.php.

get_current_language ( )

Get the current system/user language or "en".

Returns
string The language code for the site/user or "en" if not set

Definition at line 644 of file deprecated-4.3.php.

get_default_access ( ElggUser  $user = null,
array  $input_params = [] 
)

Gets the default access permission.

This returns the default access level for the site or optionally of the user. If want you to change the default access based on group of other information, use the 'default', 'access' plugin hook.

Parameters
ElggUser$userThe user for whom we're getting default access. Defaults to logged in user.
array$input_paramsParameters passed into an input/access view
Returns
int default access id (see ACCESS defines in constants.php)

Definition at line 44 of file deprecated-4.3.php.

get_dir_size (   $dir,
  $total_size = 0,
  $show_deprecation_notice = true 
)

Get the size of the specified directory.

Parameters
string$dirThe full path of the directory
int$total_sizeAdd to current dir size
Returns
int The size of the directory in bytes

Definition at line 510 of file deprecated-4.3.php.

get_entity_relationships (   $guid,
  $inverse_relationship = false 
)

Get all the relationships for a given GUID.

Parameters
int$guidGUID of the subject or target entity (see $inverse)
bool$inverse_relationshipIs $guid the target of the relationships? By default $guid is the subject of the relationships.
Returns
[]

Definition at line 396 of file deprecated-4.3.php.

get_entity_statistics ( int  $owner_guid = 0)

Return an array reporting the number of various entities in the system.

Parameters
int$owner_guidOptional owner of the statistics
Returns
array

Definition at line 278 of file deprecated-4.3.php.

get_members_of_access_collection ( int  $collection_id,
bool  $guids_only = false,
array  $options = [] 
)

Get all of members of an access collection.

Parameters
int$collection_idThe collection's ID
bool$guids_onlyIf set to true, will only return the members' GUIDs (default: false)
array$optionsege* options
Returns
[]|int|int[]|mixed guids or entities if successful, false if not

Definition at line 228 of file deprecated-4.3.php.

get_online_users ( array  $options = [])

Render a list of currently online users.

This also support options from elgg_list_entities().

Parameters
array$optionsOptions array with keys: seconds (int) => Number of seconds (default 600 = 10min)
Returns
string

Definition at line 790 of file deprecated-4.3.php.

get_readable_access_level ( int  $entity_access_id)

Return the name of an ACCESS_* constant or an access collection, but only if the logged in user has write access to it.

Write access requirement prevents us from exposing names of access collections that current user has been added to by other members and may contain sensitive classification of the current user (e.g. close friends vs acquaintances).

Returns a string in the language of the user for global access levels, e.g.'Public, 'Friends', 'Logged in', 'Public'; or a name of the owned access collection, e.g. 'My work colleagues'; or a name of the group or other access collection, e.g. 'Group: Elgg technical support'; or 'Limited' if the user access is restricted to read-only, e.g. a friends collection the user was added to

Parameters
int$entity_access_idThe entity's access id
Returns
string
Since
1.7.0

Definition at line 264 of file deprecated-4.3.php.

get_relationship (   $id)

Get a relationship by its ID.

Parameters
int$idThe relationship ID
Returns
|false False if not found

Definition at line 292 of file deprecated-4.3.php.

get_write_access_array ( int  $user_guid = 0,
  $ignored = 0,
bool  $flush = false,
array  $input_params = [] 
)

Returns an array of access permissions that the user is allowed to save content with.

Permissions returned are of the form (id => 'name').

Example return value in English: array( 0 => 'Private', -2 => 'Friends', 1 => 'Logged in users', 2 => 'Public', 34 => 'My favorite friends', );

Plugin hook of 'access:collections:write', 'user'

Warning
this only returns access collections that the user owns plus the standard access levels. It does not return access collections that the user belongs to such as the access collection for a group.
Parameters
int$user_guidThe user's GUID.
int$ignoredIgnored parameter
bool$flushIf this is set to true, this will ignore a cached access array
array$input_paramsSome parameters passed into an input/access view
Returns
array List of access permissions

Definition at line 98 of file deprecated-4.3.php.

has_access_to_entity ( \ElggEntity  $entity,
\ElggUser  $user = null 
)

Can a user access an entity.

Warning
If a logged in user doesn't have access to an entity, the core engine will not load that entity.

This is mostly useful for checking if a user other than the logged in user has access to an entity that is currently loaded.

Parameters
\ElggEntity$entityThe entity to check access for.
\ElggUser$userOptionally user to check access for. Defaults to logged in user (which is a useless default).
Returns
bool

Definition at line 65 of file deprecated-4.3.php.

is_email_address (   $address)

Validates an email address.

Parameters
string$addressEmail address.
Returns
bool

Definition at line 590 of file deprecated-4.3.php.

log_login_failure (   $user_guid)

Log a failed login for $user_guid.

Parameters
int$user_guidUser GUID
Returns
bool

Definition at line 693 of file deprecated-4.3.php.

login ( \ElggUser  $user,
  $persistent = false 
)

Logs in a specified .

For standard registration, use in conjunction with elgg_pam_authenticate.

See also
elgg_pam_authenticate()
Parameters
\ElggUser$userA valid Elgg user object
boolean$persistentShould this be a persistent login?
Returns
true or throws exception
Exceptions

Definition at line 677 of file deprecated-4.3.php.

logout ( )

Log the current user out.

Returns
bool

Definition at line 657 of file deprecated-4.3.php.

parse_urls (   $text)

Takes a string and turns any URLs into formatted links.

Parameters
string$textThe input string
Returns
string The output string with formatted links

Definition at line 559 of file deprecated-4.3.php.

register_pam_handler (   $handler,
  $importance = 'sufficient',
  $policy = 'user' 
)

Register a PAM handler.

A PAM handler should return true if the authentication attempt passed. For a failure, return false or throw an exception. Returning nothing indicates that the handler wants to be skipped.

Note, $handler must be string callback (not an array/Closure).

Parameters
string$handlerCallable global handler function in the format () pam_handler($credentials = null);
string$importanceThe importance - "sufficient" (default) or "required"
string$policyThe policy type, default is "user"
Returns
bool

Definition at line 419 of file deprecated-4.3.php.

register_user (   $username,
  $password,
  $name,
  $email,
  $allow_multiple_emails = false,
  $subtype = null,
array  $params = [] 
)

Registers a user, returning false if the username already exists.

Parameters
string$usernameThe username of the new user
string$passwordThe password
string$nameThe user's display name
string$emailThe user's email address
bool$allow_multiple_emailsAllow the same email address to be registered multiple times?
string$subtypeSubtype of the user entity
array$paramsAdditional parameters
Returns
int|false The new user's GUID; false on failure
Exceptions

Definition at line 885 of file deprecated-4.3.php.

remove_entity_relationship (   $guid_one,
  $relationship,
  $guid_two 
)

Delete a relationship between two entities.

This function lets you say "$guid_one is no longer a $relationship of $guid_two."

Parameters
int$guid_oneGUID of the subject entity of the relationship
string$relationshipType of the relationship
int$guid_twoGUID of the target entity of the relationship
Returns
bool

Definition at line 362 of file deprecated-4.3.php.

remove_entity_relationships (   $guid,
  $relationship = "",
  $inverse_relationship = false,
  $type = '' 
)

Removes all relationships originating from a particular entity.

Parameters
int$guidGUID of the subject or target entity (see $inverse)
string$relationshipType of the relationship (optional, default is all relationships)
bool$inverse_relationshipIs $guid the target of the deleted relationships? By default, $guid is the subject of the relationships.
string$typeThe type of entity related to $guid (defaults to all)
Returns
true

Definition at line 380 of file deprecated-4.3.php.

remove_user_from_access_collection ( int  $user_guid,
int  $collection_id 
)

Removes a user from an access collection.

Triggers the 'access:collections:remove_user', 'collection' plugin hook.

Parameters
int$user_guidThe user GUID
int$collection_idThe access collection ID
Returns
bool

Definition at line 212 of file deprecated-4.3.php.

reset_login_failure_count (   $user_guid)

Resets the fail login count for $user_guid.

Parameters
int$user_guidUser GUID
Returns
bool true on success (success = user has no logged failed attempts)

Definition at line 718 of file deprecated-4.3.php.

send_new_password_request (   $user_guid)

Generate and send a password request email to a given user's registered email address.

Parameters
int$user_guidUser GUID
Returns
false|array

Definition at line 836 of file deprecated-4.3.php.

string_to_tag_array (   $string)

Takes in a comma-separated string and returns an array of tags which have been trimmed.

Parameters
string$stringComma-separated tag string
Returns
mixed An array of strings or the original data if input was not a string

Definition at line 606 of file deprecated-4.3.php.

unregister_pam_handler (   $handler,
  $policy = 'user' 
)

Unregisters a PAM handler.

Parameters
string$handlerThe PAM handler function name
string$policyThe policy type, default is "user"
Returns
void
Since
1.7.0

Definition at line 435 of file deprecated-4.3.php.