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

Custom Alerts

Discussion in 'XenForo Development Discussions' started by AndyB, Jan 9, 2016.

  1. AndyB

    AndyB Well-Known Member

    Hello,

    In an add-on I'm developing I would like to send a custom alert.

    The main PHP code:

    PHP:
    $alertUserId 1;
    $userId 2;
    $username 'test';
    $contentType 'trader';
    $contentId 1001;
    $action 'insert';
    $extraData = array();

    // send alert
    XenForo_Model_Alert::alert($alertUserId$userId$username$contentType$contentId$action$extraData);   
    and the template:

    pic001.jpg

    When I check for the Alerts the red balloon shows a new alert, yet there is no alert message. What am I doing wrong?

    Thank you.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Look at how XF sends alerts, e.g. XenForo_AlertHandler_ProfilePostComment

    In addition to needing that, it also needs a content type record in the xf_content_type table and a content type field record in the xf_content_type_field table.
     
    AndyB likes this.

Share This Page