-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvents.php
More file actions
35 lines (28 loc) · 869 Bytes
/
Events.php
File metadata and controls
35 lines (28 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* Alt Notification
* @link https://www.cuzy.app
* @license https://www.cuzy.app/cuzy-license
* @author [Marc FARRE](https://marc.fun)
*/
namespace humhub\modules\altNotification;
use humhub\modules\space\MemberEvent;
use Yii;
class Events
{
public static function onSpaceMemberAdded(MemberEvent $event)
{
$space = $event->space;
$user = $event->user;
if (!$space || !$user) {
return;
}
/** @var Module $module */
$module = Yii::$app->getModule('alt-notification');
$spaceGuids = $module->configuration->newContentNotifSpaceGuids;
// If the Space is in **Module Settings**, auto-add it to their **User Settings**.
if (in_array($space->guid, $spaceGuids, true)) {
Yii::$app->notification->setSpaceSetting($user, $space, true);
}
}
}