function userprotect_user in User protect 5
Same name and namespace in other branches
- 6 userprotect.module \userprotect_user()
Implementation of hook_user().
File
- ./
userprotect.module, line 417
Code
function userprotect_user($op, &$edit, &$account) {
switch ($op) {
// A new user is being added. If auto-protect is enabled, then add protection.
case 'insert':
if (variable_get('userprotect_autoprotect', FALSE)) {
userprotect_add_user($account->uid, 'user');
$protected = array_filter(variable_get('userprotect_protection_defaults', userprotect_user_protection_defaults()));
drupal_set_message(userprotect_display_protections($account, $protected));
}
break;
// Remove a deleted user from the protections table.
case 'delete':
db_query('DELETE FROM {userprotect} WHERE uid = %d', $account->uid);
break;
}
}