function subscriptions_user in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions.module \subscriptions_user()
- 5 subscriptions.module \subscriptions_user()
Implementation of hook_user().
1 call to subscriptions_user()
- _subscriptions_get_setting in ./
subscriptions.module - Helper function to retrieve send_self/autosub_on_post/autosub_on_update/autosub_on_comment/ | 1, 0, digest/send_interval/send_updates/send_comments/ | -1 = use…
6 string references to 'subscriptions_user'
- subscriptions_update_3 in ./
subscriptions.install - Database update function 3 for 5.x-2.0 rewrite.
- subscriptions_update_4 in ./
subscriptions.install - Database update function 4 for 5.x-2.0 rewrite.
- subscriptions_update_5 in ./
subscriptions.install - Database update function 5 for 5.x-2.0 rewrite.
- subscriptions_update_6 in ./
subscriptions.install - Database update function 6 for 5.x-2.0 rewrite.
- subscriptions_update_6102 in ./
subscriptions.install - Database update function 6102: Remove the obsolete {subscriptions_user}.last_sent column if it's still there.
File
- ./
subscriptions.module, line 239 - Subscriptions module.
Code
function subscriptions_user($type, $edit, &$account, $category = NULL) {
static $new_uid = 0;
switch ($type) {
case 'insert':
db_query("INSERT INTO {subscriptions_user} (uid) VALUES(%d)", $account->uid);
// $account->roles isn't set yet, but we'll be called again with 'load'
$new_uid = $account->uid;
break;
case 'load':
if ($new_uid && $account->uid == $new_uid) {
foreach (array_keys($account->roles) as $rid) {
$rids[] = -$rid;
}
db_query("INSERT INTO {subscriptions} (module, field, value, recipient_uid, send_interval, author_uid, send_updates, send_comments)\n SELECT module, field, value, %d, send_interval, author_uid, send_updates, send_comments FROM {subscriptions}\n WHERE recipient_uid IN (%s)", $account->uid, implode(',', $rids));
$new_uid = 0;
}
break;
case 'delete':
db_query("DELETE FROM {subscriptions_user} WHERE uid = %d", $account->uid);
db_query("DELETE FROM {subscriptions} WHERE recipient_uid = %d", $account->uid);
db_query("DELETE FROM {subscriptions_last_sent} WHERE uid = %d", $account->uid);
break;
}
}