function filedepot_sendNotification in filedepot 7
Same name and namespace in other branches
- 6 lib-common.php \filedepot_sendNotification()
Send out notifications to all users that have subscribed to this file or file category Will check user preferences for notification if Messenger Plugin is installed
Parameters
string $id Key used to retrieve details depending on message type:
string $type Message type ->: (1) FILEDEPOT_NOTIFY_NEWFILE, (2) FILEDEPOT_NOTIFY_APPROVED, (3) FILEDEPOT_NOTIFY_REJECT, (4) FILEDEPOT_NOTIFY_ADMIN
Return value
Boolean Returns TRUE if atleast 1 message was sent out
6 calls to filedepot_sendNotification()
File
- ./
lib-common.php, line 388 - lib-common.php Common library of functions for the applications
Code
function filedepot_sendNotification($id, $type = 1) {
global $user;
/* If notifications have been disabled via the module admin settings - return TRUE */
if (variable_get('filedepot_notifications_enabled', 1) == 0) {
return TRUE;
}
if (intval($id) > 0) {
$target_users = filedepot_build_notification_distribution($id, $type);
if (count($target_users) > 0) {
$values = array(
'fid' => $id,
'target_users' => $target_users,
);
drupal_mail('filedepot', $type, $user, language_default(), $values);
}
else {
watchdog('filedepot', "filedepot_sendNotification (@type) - no target users", array(
"@type" => $type,
));
}
}
}