Group icon
A group for those interested in plugin development

The river

This page gives an overview of adding adding events to the River in an Elgg plugin. Elgg has native support for a River, a stream of short updates of what you and your friends are up to on your profile.

Events

The key to how the river works is the Elgg events system and the system log. The system log will listen to events and some events pass an object. If the object implements the Loggable interface it will automatically be included in the system log.

View

In order for things to appear in the river you need to provide a view.

For Entities

For entities (object, user, site, group) this should be a view:

/river/TYPE/SUBTYPE/EVENT.php

Where:

  • TYPE: is the type of entity - object, site, group, user
  • SUBTYPE: The subtype - either your subtype (eg. blog, file) or 'default' if there is no subtype
  • EVENT: The event you're listening to - eg. 'create', 'update' etc

For Relationships

For relationships (friend, member etc) this should be a view:

/river/relationship/TYPE/EVENT.php

Where:
  • TYPE: The type of relationship - 'friend', 'member' etc
  • EVENT: The event you're listening to - eg. 'create', 'update' etc

For Metadata & Annotations

For metadata or annotations this should be a view:

/river/TYPE/NAME/EVENT.php

Where:
  • TYPE: Either 'annotation' or 'metadata'
  • NAME: The name of the annotation or metadata - eg. 'comment', 'rating', 'tag'
  • EVENT: The event you're listening to - eg. 'create', 'update' etc

For widgets

Widgets are a slightly special case and require that you include an extra "handler" field, so for widgets there should be a view:

/river/object/widget/HANDLER/EVENT.php

Where:
  • HANDLER: The name of your plugin
  • EVENT: The event you are listening to - create/update/annotate etc.

In all cases, the view will be passed an Elgg River Statement object.

, , , ,

Last updated 497 days ago by Marcus Povey