Back to vBulletin 3 Articles

Using VBulletin 3.7.x notifications engine
by FractalizeR 30 May 2008

Everyone saw a nice drop-down list with all notifications you have at the top-right corner of every page. Let's look, how to add our own notifications to this list. It is very easy!

1. Create a GLOBAL phrase, that will be displayed as a text for your notification. Let's consider it's name to be MyNotificationName.
2. Create plugin for hook notifications_list with the following code:

PHP Code:
 if($MyNotificationNeedsToBeShown) {
    
$notifications['MyNotificationName'] = array(
        
'phrase' => $vbphrase['MyNotificationName'],
        
'link'   => 'mylinkpage.php',
        
'order'  => 100
        
);
$vbulletin->userinfo['MyNotificationName'] = $MyNotificationCount;

  • MyNotificationName - is just a string, a unique name of your notification.
  • $MyNotificationNeedsToBeShown - you can insert here any condition, that evaluates to true, then your notification needs to be shown
  • mylinkpage.php - is the name of the page, user will be redirected to, when he clicks your notification in menu. Page name should be relative to VB root or absolute (http://...)
  • $MyNotificationCount - a number, that will be shown near your notification. This number will be added to a total notifications number displayed by VB.
That's all Really simple, eh?

vblts.ru supports vBulletin®, 2022-2024