Plugin Activity Stream | |
The activity stream is a Tiki12 feature allowing to create social network activity streams within Tiki. The feature depends on the Search and List from Unified Index and Elasticsearch is highly recommended to obtain decent performance. In order to create activity streams, you will need to define what the important events are in your system. Events like "tracker item created" or "wiki page modified" will rarely make sense to your users looking at an activity stream. Instead, they may be interested when photos are posted by their friends. No matter where you decide to store pictures, whether they are in file galleries, or as tracker items with meta-data, the desired event for the end user remains the same. The activity stream feature allows to intercept system events, filter them and trigger new events. These new events can be recorded and indexed, which will allow them to be displayed in an activity stream. |
Video Introduction | ||
Presentation of the activity stream feature during the TikiFestBootstrap in 2013 by Nelson Ko:
See also: Tiki Activity Stream Presentation |
Parameters | |||||||||||||||
Create a social network activity stream. Introduced in Tiki 12. Go to the source code Preferences required: wikiplugin_activitystream, feature_search
|
Basic events | |
You can choose to enable recording of basic events through preferences in the community administration panel. This is primarily in place to quickly test the functionality. |
Displaying Activity Streams | |
Activity streams are rendered as a wiki plugin. The base plugin will render all activities in the system (as long as permissions allow). Copy to clipboard
Copy to clipboard
|
Custom activities, Activity Rules | |
On the Admin Control Panel, Community, Social Interaction, Activity stream section (tiki-admin.php?page=community#contentadmin_community-2) you can enable "Custom activities" to create your own set of rules.
|
Example | |
In this example we want to create a new event called mysite.bugtracker.save which only triggers if something in tracker 5 is created/updated. If I use the Tracker Rule UI it will generate this for me: Copy to clipboard
If I then want to extend this to filter only for situations where the value of the version field is 15, I would have to convert it to an Advanced rule and them modify it to do as follows. In the following example, I have also mapped the version field over to "version" in the new mysite.bugtracker.save for being used in templates etc. Copy to clipboard
After I set Basic Rule (Record Event) for mysite.bugtracker.save, that event will be recorded. The filter I can use is then:
|
Filtering events | ||||||||
Multiple entries for the "personalize" filter can be separated by commas. Valid options are:
|
|
Filtering the information displayed on a wiki page | |
You can also filter the activity stream using the same syntax as filters in PluginList. For example, you could filter on categories to limit to a specific project. Note that you can only filter on the fields that are available (which is not the same as the fields of the object that triggered the activity). Activity streams are basically a special kind of LIST of "indexed activities". All activities have global fields such as "categories", so if you want to filter by categories you can simply use the filter like in the LIST plugin as follows and it will work: However, if you want to filter on the information in the activity (i.e. things about the object that it relates to etc...) you would need to determine the field names of the activity which would differ depending on which activity is it. To investigate what fields are in an activity, you would have to create a Sample Rule in the Activity Rules panel in the Community Control Panel: If you want then to record this event, you would need to use Basic Rule (Record Event) or if it is one of the basic events that have a preference to turn on recording, you can turn it on simply through preferences in the community administration panel. Or if you want to setup a custom event that is created based on a filtered version of this event you will use Advanced Rule. Tracker Rule is a convenience UI (compared to using an advanced rule) developed to create a simple filter of Tracker streams by tracker. The event filtering logic is built using the Rating Language, detailed with the Calculations. Through the community administration panel, the rules can be managed. For advanced usage, the programming can be written directly. This is a new feature and over time, it is hoped that convenience UI such as the Tracker Rule will be created/improved to make it easier to setup custom rules without having to write Rating Language.
|
Rendering Activities | |
Within the activity stream, each activity will be rendered using a custom template. The template will be named according to the event name. If you create an event named mysite.photo.upload, the template file used will be |
Grouping Similar Activities | |
It may occur frequently that multiple similar events get triggered by the system. For example, successive edits of a wiki page by a single user would trigger one event per edit. If you chose to trigger custom events for those modifications and to record them, the activity stream would become polluted. The activity stream plugin contains a directive to allow grouping similar activities so that:
The convention is to use the field aggregate to contain the hash, but you could become creative about this.
Copy to clipboard
To create a fixed-size list of 15 Recent Activities with aggregation, the amount of results obtained can augment the amount of results returned and get the list to be truncated afterwards. The following snippet instructs to obtain 3 times more results than desired. After aggregation, will truncate the list back to 15. The list may still contain fewer results than desired, but with a reasonable threshold, this should be reduced. Using this option will disable pagination and auto-scrolling. Copy to clipboard
To assist in the creation of custom hash values, the hash function is available in the Rating Language
|
Related links | |
Aliases
|