Jake B.
Well-known member
I'm currently working on an addon, and I'm having a problem getting it to display the alerts after a certain action happens. I have created the appropriate rows in xf_content_type, and xf_content_type_field and pointed it towards my AlertHandler, which is being called. But for some reason it will not display the alert. It shows that I have a new alert, but doesn't display it.
Here is my alert handler:
It is selecting all of the rows from in the getContentByIds function, but the _prepareAlertBeforeAction function isn't even running.
Here is my alert handler:
Code:
<?php
class XenStop_Casino_AlertHandler_Casino extends XenForo_AlertHandler_Abstract
{
protected $_postModel = null;
public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser)
{
$betModel = $model->getModelFromCache('XenStop_Casino_Model_Casino');
return $betModel->getBetsByIds($contentIds);
}
protected function _prepareAlertBeforeAction(array $item, $content, array $viewingUser)
{
if($item['content_type']=='casino_bet'){
if ($item['extra_data']) {
$item['extra'] = unserialize($item['extra_data']);
$item['winlose'] = $item['extra']['win_lose'];
if($item['winlose'] == 1) {
$item['amount'] = intval($item['extra']['bet_amount']) * 2;
} else {
$item['amount'] = $item['extra']['bet_amount'];
}
}
}
unset($item['extra_data']);
return $item;
}
protected function _getDefaultTemplateTitle($contentType, $action) {
return 'xenstop_casino_alert';
}
}
It is selecting all of the rows from in the getContentByIds function, but the _prepareAlertBeforeAction function isn't even running.