Elgg  Version master
Functions
river.php File Reference

Go to the source code of this file.

Functions

 elgg_create_river_item (array $options=[])
 Elgg river. More...
 
 elgg_get_river (array $options=[])
 Get river items. More...
 
 elgg_get_river_item_from_id (int $id)
 Get river item from its ID. More...
 
 elgg_delete_river (array $options=[])
 Delete river items based on $options. More...
 
 elgg_list_river (array $options=[])
 List river items. More...
 

Function Documentation

elgg_create_river_item ( array  $options = [])

Elgg river.

Activity stream functions. Adds an item to the river.

Read the item like "Lisa (subject) posted (action) a comment (object) on John's blog (target)".

Parameters
array$optionsArray in format:

string $view The view that will handle the river item string $action_type An arbitrary string to define the action (eg 'comment', 'create') int $subject_guid The GUID of the entity doing the action (default: current logged in user guid) int $object_guid The GUID of the entity being acted upon int $target_guid The GUID of the the object entity's container int $posted The UNIX epoch timestamp of the river item (default: now) int $annotation_id The annotation ID associated with this river entry

Returns
ElggRiverItem|null Riveritem or null on failure
Since
1.9

Definition at line 28 of file river.php.

elgg_delete_river ( array  $options = [])

Delete river items based on $options.

Warning
Unlike elgg_get_river() this will not accept an empty options array! This requires at least one constraint: id(s), annotation_id(s) subject_guid(s), object_guid(s), target_guid(s) or view(s) must be set.

Access is ignored during the execution of this function. Intended usage of this function is to cleanup river content. For an example see actions/avatar/upload.

Parameters
array$optionsAn options array. elgg_get_river()
Returns
bool true on success, false on failure
Exceptions

Definition at line 135 of file river.php.

elgg_get_river ( array  $options = [])

Get river items.

Supports passing the following options ids => INT|ARR River item id(s) subject_guids => INT|ARR Subject guid(s) object_guids => INT|ARR Object guid(s) target_guids => INT|ARR Target guid(s) action_types => STR|ARR The river action type(s) identifier posted_time_lower => INT The lower bound on the time posted posted_time_upper => INT The upper bound on the time posted

annotation_ids => INT|ARR The identifier of the annotation(s)

Additionally accepts all "annotation_*" options supported by elgg_get_entities() but not annotation_ids as that applies to the river table

types => STR|ARR Entity type string(s) subtypes => STR|ARR Entity subtype string(s) type_subtype_pairs => ARR Array of type => subtype pairs where subtype can be an array of subtype strings

NOTE: If using types and subtypes in a query, they are joined with an AND.

Additionally accepts all "relationship_*" options supported by elgg_get_entities() relationship => STR Relationship identifier relationship_guid => INT|ARR Entity guid(s) inverse_relationship => BOOL Subject or object of the relationship (false) relationship_join_on => STR subject_guid|object_guid|target_guid (defaults to subject_guid)

limit => INT Number to show per page (20) offset => INT Offset in list (0) count => BOOL Count the river items? (false) order_by => STR Order by clause (rv.posted desc) group_by => STR Group by clause

distinct => BOOL If set to false, Elgg will drop the DISTINCT clause from the MySQL query, which will improve performance in some situations. Avoid setting this option without a full understanding of the underlying SQL query Elgg creates. (true)

batch => BOOL If set to true, an object will be returned instead of an array. (false) Since 2.3.

batch_inc_offset => BOOL If "batch" is used, this tells the batch to increment the offset on each fetch. This must be set to false if you delete the batched results. (true)

batch_size => INT If "batch" is used, this is the number of entities/rows to pull in before requesting more. (25)

Parameters
array$optionsparameters
Returns
[]||array|int
Since
1.8.0

Definition at line 101 of file river.php.

elgg_get_river_item_from_id ( int  $id)

Get river item from its ID.

Parameters
int$idID
Returns
ElggRiverItem|null

Definition at line 112 of file river.php.

elgg_list_river ( array  $options = [])

List river items.

Parameters
array$optionsAny options from elgg_get_river() plus:
  • item_view => STR Alternative view to render list items
  • pagination => BOOL Display pagination links (true)
  • no_results => STR|true|Closure Message to display if no items
Returns
string
Since
1.8.0

Definition at line 194 of file river.php.