This repository was archived by the owner on Jul 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunctions.php
More file actions
57 lines (47 loc) · 1.25 KB
/
Copy pathfunctions.php
File metadata and controls
57 lines (47 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* Module Functions
* (Loaded on each page)
*
* @package Messaging module
*/
/**
* Messaging module Portal Alerts.
* Messaging new messages note.
*
* @uses misc/Portal.php|portal_alerts hook
*
* @return true if new messages note, else false.
*/
function MessagingPortalAlerts()
{
global $note;
if ( ! AllowUse( 'Messaging/Messages.php' ) )
{
return false;
}
require_once 'modules/Messaging/includes/Common.fnc.php';
$user = GetCurrentMessagingUser();
$new_msg_RET = DBGet( DBQuery( "SELECT count(*) AS COUNT
FROM MESSAGEXUSER mxu, MESSAGES m
WHERE mxu.USER_ID='" . $user['user_id'] . "'
AND mxu.KEY='" . $user['key'] . "'
AND STATUS='unread'
AND m.MESSAGE_ID=mxu.MESSAGE_ID
AND m.SYEAR='" . UserSyear() . "'
AND m.SCHOOL_ID='" . UserSchool() . "'" ) );
if ( isset( $new_msg_RET[1]['COUNT'] )
&& $new_msg_RET[1]['COUNT'] > 0 )
{
// Add note.
$note[] = '<a href="Modules.php?modname=Messaging/Messages.php">
<img src="modules/Messaging/icon.png" class="button bigger" /> ' .
sprintf(
ngettext( '%d new message', '%d new messages', $new_msg_RET[1]['COUNT'] ),
$new_msg_RET[1]['COUNT']
) . '</a>';
return true;
}
return false;
}
add_action( 'misc/Portal.php|portal_alerts', 'MessagingPortalAlerts', 0 );