function notifications_notifications_subscription in Notifications 6.4
Implementation of hook notifications_subscription()
File
- ./
notifications.module, line 1746 - Notifications module
Code
function notifications_notifications_subscription($op, $subscription = NULL, $account = NULL) {
switch ($op) {
case 'access':
// First we check valid subscription type
$access = FALSE;
if ($subscription->type && ($info = notifications_subscription_types($subscription->type))) {
// To allow mixed subscription types to work we dont have a fixed field list
// Then check specific access to this type. Each type must have a permission
if (!empty($info['access callback'])) {
$access = call_user_func($info['access callback'], $account, $subscription);
}
elseif (!empty($info['access'])) {
$access = $info['access'] === TRUE || user_access($info['access'], $account);
}
// If allowed access so far, check field values
if ($access) {
$access = $subscription
->check_fields();
}
}
return $access;
break;
case 'page objects':
if (arg(0) == 'user' && is_numeric(arg(1)) && ($account = menu_get_object('user'))) {
return array(
'user' => $account,
);
}
break;
}
}