Activity instances are created for special events in the context of a
humhub\modules\content\models\ContentContainer|ContentContainer like the creation of content.
Contrary to notifications - activities are always bound to a
humhub\modules\content\models\ContentContainer|ContentContainer, and are not targeted for specific users.
Besides the relation to the
ContentContainer - an activity can also be assigned with a Content or ContentAddon and automatically inherits some content properties such as
Similar to notifications activities can be related to an
originator user and a
The activity will adopt some properties as the
visibility in cas of
Implement a Custom Activity
Create Class & View
Your custom activites should reside in your modules
class SomethingHappend extends BaseActivity
// View Name for activity
public $viewName = "somethingHappend";
// Module Id (required)
public $moduleId = "example";
By default activity views should be located inside a
activities/views directory (e.g.
Example view file somethingHappend.php:
echo Yii::t('ExampleModule.views_notifications_newLike', "%someUser% did something cool.", array(
'%someUser%' => '<strong>' . Html::encode($originator->displayName) . '</strong>'
If you require a different view for mails, you have to add a view with the same view name to the