Source of file ReadNotificationExtension.php
Size: 0,671 Bytes - Last Modified: 2021-12-23T10:25:43+00:00
/var/www/docs.ssmods.com/process/src/src/Extension/ReadNotificationExtension.php
123456789101112131415161718192021222324 | <?php namespace Symbiote\Notifications\Extension; use SilverStripe\Core\Extension; use SilverStripe\Security\Member; use Symbiote\Notifications\Model\InternalNotification; class ReadNotificationExtension extends Extension { public function onBeforeInit() { $member = Member::currentUser(); if ($member && $this->owner->getRequest()->getVar('notification')) { $id = $this->owner->getRequest()->getVar('notification'); $note = InternalNotification::get()->byID($id); if ($note && $note->ToID == $member->ID) { $note->IsRead = 1; $note->write(); } } } } |