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

Steps for creating custom alerts

Hello everybody, thanks for your previous help. Today, i'm here to ask you the steps for creating custom alerts please.
==> What I need, is the different steps i have to do before i can show a custom alert. For example, i've made this line :
$alertModel->alertUser(17, 17, 'Zekrose', 'comments', '15098', 'answer');
i researched a bit on the internet, and i found that i have to create a template `alert_comments_answer`. So, i did it and now i'm wondering what do I have to do now because the alerts don't show... Thanks for future help and i apologise for my quite 'beginner' question...
Have a good afternoon !


Well-known member
Check out two tables 'xf_content_type' & 'xf_content_type_field'. Just see how alert_handler_class are added for XenForo and other add ons which have custom alerts. You just insert rows in this table.
After that create a template with the name 'alert_{content_type}_{action}' which in your case might be 'alert_comments_answer'.

Thats all you need for your alerts to be displayed.


Well-known member
Normally what Aayush wrote is done during your install routine. Once you inserted your custom alert info into those tables you should then rebuild the content cache:

XenForo_Application::set('contentTypes', XenForo_Model::create('XenForo_Model_ContentType')->getContentTypesForCache());