vbulletin我如何使用Ajax获得即时通知。
中的global.php通知代码对不起,没有外国人。这是我的代码:
// set up user notifications
$show['notifications'] = false;
if ($vbulletin->userinfo['userid'])
{
$notifications = array();
if ($show['pmstats'])
{
$notifications['pmunread'] = array(
'phrase' => $vbphrase['unread_private_messages'],
'link' => 'private.php' . $vbulletin->session->vars['sessionurl_q'],
'order' => 10
);
}
if (
$vbulletin->userinfo['vm_enable']
AND
$vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_visitor_messaging']
AND
$permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers']
)
{
$notifications['vmunreadcount'] = array(
'phrase' => $vbphrase['unread_profile_visitor_messages'],
'link' => 'member.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $vbulletin->userinfo['userid'] . '&tab=visitor_messaging',
'order' => 20
);
if ($permissions['visitormessagepermissions'] & $vbulletin->bf_ugp_visitormessagepermissions['canmanageownprofile'])
{
$notifications['vmmoderatedcount'] = array(
'phrase' => $vbphrase['profile_visitor_messages_awaiting_approval'],
'link' => 'member.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $vbulletin->userinfo['userid'] . '&tab=visitor_messaging',
'order' => 30
);
}
}
// check for incoming friend requests if user has permission to use the friends system
if (($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_friends']) AND ($permissions['genericpermissions2'] & $vbulletin->bf_ugp_genericpermissions2['canusefriends']))
{
$notifications['friendreqcount'] = array(
'phrase' => $vbphrase['incoming_friend_requests'],
'link' => 'profile.php?' . $vbulletin->session->vars['sessionurl'] . 'do=buddylist#irc',
'order' => 40
);
}
// social group invitations and join requests
if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'])
{
// check for requests to join your own social groups, if user has permission to create groups
if ($permissions['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['cancreategroups'])
{
$notifications['socgroupreqcount'] = array(
'phrase' => $vbphrase['requests_to_join_your_social_groups'],
'link' => 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=requests',
'order' => 50
);
}
// check for invitations to join social groups, if user has permission to join groups
if ($permissions['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canjoingroups'])
{
$notifications['socgroupinvitecount'] = array(
'phrase' => $vbphrase['invitations_to_join_social_groups'],
'link' => 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=invitations',
'order' => 60
);
}
}
// picture comment notifications
if ($vbulletin->options['pc_enabled']
AND $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums']
AND $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers']
AND $permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum']
AND $permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canalbum']
)
{
$notifications['pcunreadcount'] = array(
'phrase' => $vbphrase['unread_picture_comments'],
'link' => 'album.php?' . $vbulletin->session->vars['sessionurl'] . 'do=unread',
'order' => 70
);
if ($permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canmanagepiccomment'])
{
$notifications['pcmoderatedcount'] = array(
'phrase' => $vbphrase['picture_comments_awaiting_approval'],
'link' => 'album.php?' . $vbulletin->session->vars['sessionurl'] . 'do=moderated',
'order' => 80
);
}
}
if (
$vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups']
AND $vbulletin->options['socnet_groups_msg_enabled']
AND $vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canmanageowngroups']
)
{
$notifications['gmmoderatedcount'] = array(
'phrase' => $vbphrase['group_messages_awaiting_approval'],
'link' => 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=moderatedgms',
'order' => 90
);
}
($hook = vBulletinHook::fetch_hook('notifications_list')) ? eval($hook) : false;
$notifications_order = array();
foreach ($notifications AS $userfield => $notification)
{
$notifications_order["$notification[order]"]["$userfield"] = $userfield;
}
ksort($notifications_order);
$notifications_total = 0;
$notifications_menubits = '';
foreach ($notifications_order AS $notification_order => $userfields)
{
ksort($notifications_order["$notification_order"]);
foreach ($userfields AS $userfield)
{
$notification =& $notifications["$userfield"];
if ($vbulletin->userinfo["$userfield"] > 0)
{
$show['notifications'] = true;
}
$notifications_total += $vbulletin->userinfo["$userfield"];
$notification['total'] = vb_number_format($vbulletin->userinfo["$userfield"]);
eval('$notifications_menubits .= "' . fetch_template('navbar_notifications_menubit') . '";');
}
}
$notifications_total = vb_number_format($notifications_total);
}