PDA

View Full Version : Adding a notification.


Kyojii
07-30-2012, 07:45 AM
Just wondering how you would go about adding a notification.

$notifications_total += 1;
$template_hook['notifications_menubits'] .= "<li>test</li>";

Didn't seem to work when hooked into process_templates_complete or global_start. The templates are stil reading $notifications_total as being empty and displaying that there are no new notifications.

kh99
07-30-2012, 11:09 AM
There's no hook you can use to simply increase notifications_total or add to the menu, and it doesn't look like notifications_menubit is a template hook. But you can create a plugin using hook notifications_list and add to the $notifications[] array, like:

$notifications['test_count'] = array(
'phrase' => 'My Test Notification',
'link' => 'wheretogo.php',
'order' => 20
);
$vbulletin->userinfo['test_count'] = 1;


Also, for this to work you need a corresponding field in $vbulletin->userinfo, as shown in the last line. The count can be anything > 0.

You can look in function build_notifications() in includes/class_bootstrap.php around line 1067 if you want to see what's going on.

Kyojii
07-31-2012, 09:42 AM
Thanks