Quote:
Originally Posted by OcR Envy
Still no Notifications on a Challenge / Team Join Request?
One more try, I've added a Notification for Ladders. It will add 1 query per page and it isn't tested extensively but it works for now.
Add New Plugin
Product: Whatever
Hook: notification_list
Title: Whatever
Code:
PHP Code:
$challenges = $vbulletin->db->query_read("SELECT COUNT(*) AS challenges, games.*, games.u AS uid, games.u2 AS u2id, ladders.title AS ltitle, user.teamname AS u, user2.teamname AS u2
FROM vb_tmnt_ladder_games AS games
LEFT JOIN vb_tmnt_ladders AS ladders
ON (games.lid = ladders.id)
LEFT JOIN vb_tmnt_teams AS user
ON (games.u = user.teamid)
LEFT JOIN vb_tmnt_teams AS user2
ON (games.u2 = user2.teamid)
WHERE (games.u IN (1) OR games.u2 IN (1))
AND games.finished = 0
AND games.accepted != -1
AND games.pot = 1
AND user2.userid = ".$vbulletin->userinfo['userid']."");
$challenges = $vbulletin->db->fetch_array($challenges);
$vbulletin->userinfo["challenge_notify"] = $challenges['challenges'];
$notifications["challenge_notify"] = array(
'phrase' => 'Ladder Notification',
'order' => '1',
'link' => 'ladders.php?do=challenges'
);
|
Cheers for the code suggestion, I've simplified the code and added it as plugin in next version
PHP Code:
$challenges = $vbulletin->db->query_first("SELECT COUNT(*) AS countrows
FROM " . TABLE_PREFIX . "tmnt_ladder_games AS games
WHERE (games.u2 = ".$vbulletin->userinfo['userid'].")
AND games.finished = 0
AND games.accepted = 0
AND games.pot = 0
");
$vbulletin->userinfo["challenge_notify"] = $challenges['countrows'];
$notifications["challenge_notify"] = array(
'phrase' => 'New Ladder Challenge',
'order' => '1',
'link' => 'ladders.php?do=challenges'
);