Elgg natively supports the river, an activity stream containing descriptions of your and your friends' activities. This information is provided by a plugin called Elgg River Dashboard, which can be used in place of the main dashboard or as its own, separate page. This page gives an overview of adding adding events to the river in an Elgg plugin.
Items are pushed to the activity river through a function call, which you must include in your plugins for the items to appear:
add_to_river( $viewname, $action, $user_performing_action_guid, $entity_being_acted_on_guid );
$viewname is the name of the view that will display the river item
$action is a short machine identifier for the action (eg create)
When an item is deleted or changed, the river item will be updated automatically.
In order for system log events to appear in the river you need to provide a corresponding view with the name specified in the function above. We recommend /river/{CLASSNAME}/{EVENT}, where {CLASSNAME} is the class you’re interested in (ElggObject for objects, ElggUser for users, and so on) and {EVENT} is the event (create, update, delete and so on).
For example, if you want to output create events for all ElggObjects then you might create a view called create at /river/ElggObject/create.php. However, you can call the view whatever you'd like.
River item information will be passed in an object called $vars['item'], which contains the following important parameters:
$vars['item']->subject_guid The GUID of the user performing the action
$vars['item']->object_guid The GUID of the entity being acted upon
Timestamps etc will be generated for you.
For example, the file plugin uses the following code for its river view:
<?php $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); $object = get_entity($vars['item']->object_guid); $url = $object->getURL(); $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; $string = sprintf(elgg_echo("file:river:created"),$url) . " "; $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("file:river:item") . "</a>"; echo $string; ?>