Adding your own events to activity stream

Use case description

The CB Activity stream already has many input streams from CB events, GroupJive events, CB plugin events (Profile Book, Profile Gallery, Blogs, etc.) and Kunena. But sometimes we want to give an extra special activity more focus on our stream.

This use case will create a special activity stream entry based when users update a specific CB field in their user profile. In order to make the use case easier to understand and to perhaps motivate and inspire here is a sample situation for your consideration:

  • Our user profiles have a cb_mood field that is configured as a single select drop-down field which can be set to one of the following values:
    • Feeling awesome
    • Happy
    • Excited
    • Bored
    • Sad
    • Depressed
  • We want to highlight everyones mood change on our CB Activity stream. So when someone changes his mood a new entry is pushed on the stream.

Implementation

This use case can be implemented by configuring a single Activity action using the CB Auto Actions (version 3.4 or better needed).

The auto action parameters for this use case are:

  • The type parameter is set to CB Activity
  • The trigger for the auto action is the onAfterUserUpdate event (which fires when a user profile is updated from frontend).
  • The conditional filtering for our cb_mood field change check needs to compare the [var1_cb_mood] value (which will contacin the new field value after profile update) with the [var3_cb_mood] value (which contacins the old field value before profile update)
  • The Owner of the activity is the id of the profile being updated (this is set to [var1_id])
  • The type parameter of the action is set to "Mood change" (this will be displayed in the backend CB Activity panel)
  • The From parameter is set to From [var3_cb_mood]
  • The To parameter is set to [var1_cb_mood]
  • The title of the activity is set to "Changed mood"

The configured auto action is shown in this screenshot:

 

auto-action-activity2

 

And the result when our test user updated the profile mood field is illustrated in the following image:

auto-action-activity-result

Open Source

Everything you download from Joomapolis - whether free or paid - is GPL v2 licensed. This means that you can install it on all your websites and use it forever. Learn more about your GPL v2 privileges.

Facebook Twitter LinkedIn