Users don't have permission to view a custom alert

Lyphiard

Active member
I'm having an interesting problem with one of my addons that will send a user a custom alert. To send them an alert, I use the following code:

Code:
XenForo_Model_Alert::alert(
        $user['user_id'],
        $visitor['user_id'],
        $visitor['username'],
        'post',
        $threadId,
        'update_new',
        array('postId' => $postId)
);

Users will receive the alert (there will be the little red flag that shows they have a new alert), but as soon as they hover over the alerts button, it quickly disappears and nothing shows up.

The interesting thing is that if I edit the user's permissions and allow them to see deleted content/threads, the alert will show up for them, even if they previously were not able to see it.
 
If you use content type of 'post'. You should assign content ID is post_id instead of thread_id.
Thanks! Changing it to $postId still doesn't fix the problem with the notifications only showing up for users with the view deleted posts permission though.
 
I finally resorted to creating a custom content_type, which finally allowed me to send the alert properly.
 
Back
Top Bottom