rUserId !== null) { $key = array_search($authorUserId, $mentionedUserIds); if ($key !== false) { unset($mentionedUserIds[$key]); } } $alertType = \MybbStuff_MyAlerts_AlertTypeManager::getInstance()->getByCode('dvz_mentions_' . $locationName); if ($alertType && $alertType->getEnabled()) { $alerts = []; foreach ($mentionedUserIds as $userId) { if (call_user_func_array('dvzMentions\\Alerts\\' . ucfirst($locationName) . '\\alertPossible', [$locationData, $userId])) { $alert = new \MybbStuff_MyAlerts_Entity_Alert(); $alert->setType($alertType) ->setUserId($userId) ->setExtraDetails($alertDetails); if (!empty($locationData['object_id'])) { $alert->setObjectId($locationData['object_id']); } if (!empty($locationData['author'])) { $alert->setFromUserId($locationData['author']); } $alerts[] = $alert; } } if ($alerts) { \MybbStuff_MyAlerts_AlertManager::getInstance()->addAlerts($alerts); } } } function deleteAlerts(array $alerts): bool { return \MybbStuff_MyAlerts_AlertManager::getInstance()->deleteAlerts($alerts); } function deleteAlertsByLocationAndObjectId(string $locationName, int $objectId): bool { global $db; $alertType = \MybbStuff_MyAlerts_AlertTypeManager::getInstance()->getByCode('dvz_mentions_' . $locationName); if ($alertType) { $alertTypeId = $alertType->getId(); return $db->delete_query('alerts', 'alert_type_id=' . (int)$alertTypeId . ' AND object_id=' . (int)$objectId); } else { return false; } }