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

XF 2.0 Creating an alert

AndyB

Well-known member
#1
Hello,

I'm creating an add-on for XF2 that requires a custom alert.

The following code:

PHP:
$userId = 2;
$user = \XF::app()->find('XF:User', $userId);
$alertRepo = \XF::app()->repository('XF:UserAlert');
$alertRepo->alert($user, $user->user_id, $user->username, 'user', $user->user_id, 'upgrade_end');
Produces this:

1504901316832.png

I searched for the 'upgrade_end' in the PHP code, Templates and Phrases, but I can't find where this is defined.
 
Last edited:

AndyB

Well-known member
#2
Got it!

The 'upgrade_end' is actually a template called 'alert_user_upgrade_end', so all I needed to do was create a new template to acheive the alert I want to display.