function notifications_user in Notifications 6.3
Same name and namespace in other branches
- 5 notifications.module \notifications_user()
- 6.4 notifications.module \notifications_user()
- 6 notifications.module \notifications_user()
- 6.2 notifications.module \notifications_user()
- 7 notifications.module \notifications_user()
Implementation of hook_user().
File
- ./
notifications.module, line 300 - 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('UPDATE {notifications} SET status = %d WHERE status = %d AND uid = %d', NOTIFICATIONS_SUBSCRIPTION_BLOCKED, NOTIFICATIONS_SUBSCRIPTION_ACTIVE, $user->uid);
notifications_queue_clean(array(
'uid' => $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;
}
}