function notifications_user in Notifications 5
Same name and namespace in other branches
- 6.4 notifications.module \notifications_user()
- 6 notifications.module \notifications_user()
- 6.2 notifications.module \notifications_user()
- 6.3 notifications.module \notifications_user()
- 7 notifications.module \notifications_user()
Implementation of hook_user().
File
- ./
notifications.module, line 153 - Notifications module
Code
function notifications_user($type, $edit, &$user, $category = NULL) {
switch ($type) {
case 'delete':
// Delete related data on tables
notifications_delete_subscriptions(array(
'uid' => $user->uid,
));
break;
case 'update':
if (isset($edit['status'])) {
if ($edit['status'] == 0) {
// user is being blocked now
// Delete pending notifications and block existing active subscriptions
db_query('DELETE FROM {notifications_queue} WHERE uid = %d', $user->uid);
db_query('UPDATE {notifications} SET status = %d WHERE status = %d AND uid = %d', NOTIFICATIONS_SUBSCRIPTION_BLOCKED, NOTIFICATIONS_SUBSCRIPTION_ACTIVE, $user->uid);
}
else {
// User may be being unblocked, unblock subscriptions if any
db_query('UPDATE {notifications} SET status = %d WHERE status = %d AND uid = %d', NOTIFICATIONS_SUBSCRIPTION_ACTIVE, NOTIFICATIONS_SUBSCRIPTION_BLOCKED, $user->uid);
}
}
break;
case 'form':
if ((user_access('maintain own subscriptions') || user_access("admin users subscriptions")) && $category == 'account') {
// Add settings into Messaging group
$form = messaging_user($type, $edit, $user, $category);
}
break;
}
}