Gossamer
Active member
Hello! So, I previously had alerts working for my customization. However, I was originally just using a query to select all admins to send the alert to when it was triggered. I'm now updating that so that there is an option to select what usergroups to send the alert to.
I have the options setup, and everything else is working fine. However, the alert itself is not triggering. My php is still pretty shaky and I've been learning as I go, but this is what I have so far:
Reserves Model
Any ideas?
I have the options setup, and everything else is working fine. However, the alert itself is not triggering. My php is still pretty shaky and I've been learning as I go, but this is what I have so far:
Reserves Model
PHP:
public function sendReserveAlert($id, $alertType)
{
$reserve = $this->getReservebyID($id);
$userGroups = XenForo_Application::getOptions()->reserves_ReserveAlertGroup;
$ugModel = XenForo_Model::create('XenForo_Model_UserGroup');
$users = array();
FOREACH ($userGroups AS $usergroup)
{
$users[] = $ugModel->getUserIdsInUserGroup($usergroup);
}
$userModel = XenForo_Model::create('XenForo_Model_User');
FOREACH ($users AS $userid)
{
$user = $userModel->getUserById($userid);
XenForo_Model_Alert::alert(
$user['user_id'],
$reserve['user_id'],
$reserve['username'],
'reserve',
$reserve['id'],
$alertType,
array(
'character' => $reserve['character'],
'fandom' => $reserve['fandom'],
'count' => $reserve['count'])
);
$alerted[] = $user['user_id'];
}
}
Any ideas?