function notifications_content_notifications_object_user in Notifications 6.4
Implementation of hook_notifications_object_user()
File
- notifications_content/
notifications_content.module, line 443 - Subscriptions to content events
Code
function notifications_content_notifications_object_user($op, $user, $account = NULL) {
switch ($op) {
case 'conditions':
// Condition fields for subscriptions to this object type (user)
return array(
'uid' => $user->uid,
'author' => $user->uid,
);
case 'subscriptions':
// Option subscriptions to user account. Checking permissions here will save some processing.
$options = array();
// All posts by author
if (!$account || user_access('subscribe to author', $account)) {
$options[] = array(
'name' => t('All posts by @name', array(
'@name' => $user->name,
)),
'type' => 'author',
'fields' => array(
'author' => $user->uid,
),
);
}
// Content types with author subscriptions
if (!$account || user_access('subscribe to content type and author', $account)) {
foreach (notifications_content_types('typeauthor') as $type => $type_name) {
$options[] = array(
'name' => t('@type posts by @name', array(
'@name' => $user->name,
'@type' => $type_name,
)),
'type' => 'typeauthor',
'fields' => array(
'author' => $author->uid,
'type' => $type,
),
);
}
}
return $options;
}
}