• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Need help with custon alerts

Micheal

Well-known member
#1
Hi all

I need a little help with a custom alert as when i hover over the alert it show no alert.

i have it inserting into the database xf_user_alert


14 1 3 testuser microdownloads 1 fileupdated 1345282675 13452826

i have also got this for the xf_content_type

microdownloads MicroDownloads [BLOB - 0B]

and this for the xf_content_type_field

microdownloads alert_handler_class MicroDownloads_AlertHandler_FileUpdates

this is the test code im using

PHP:
XenForo_Model_Alert::alert(
                            1,
                            3,
                            'testuser',
                            'microdownloads',
                            $input['comment_id'],
                            'fileupdated'
                        );
and this is the code in my handler

PHP:
<?php
 
class MicroDownloads_AlertHandler_FileUpdates extends XenForo_AlertHandler_Abstract
{
 
    public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser)
    {
 
        /* @var $conversationModel XenForo_Model_Conversation */
        $Model = $model->getModelFromCache('MicroDownloads_Model_MicroDownloads');
 
        return $Model->getFileByID($userId, $contentIds);
    }
 
    protected function _prepareReply(array $item)
    {
        if ($item['extra_data'])
        {
            $item['extra'] = unserialize($item['extra_data']);
            //$item['message'] = $item['extra']['message'];
            $item['product'] = $item['extra']['product'];
        }
        unset($item['extra_data']);
 
        return $item;
    }
}
this is my template alert_microdownloads_fileupdated

HTML:
{xen:phrase microdownloads_file_updated,
    'name={xen:helper username, $user, 'subject'}',
    'link={xen:link microdownloads, $content}',
    'title={$content.title}'}
anyone that could help would ge great thank you.