function user_relationship_defaults_user in User Relationships 6
Same name and namespace in other branches
- 5 plugins/user_relationship_defaults/user_relationship_defaults.module \user_relationship_defaults_user()
- 5.2 plugins/user_relationship_defaults/user_relationship_defaults.module \user_relationship_defaults_user()
File
- user_relationship_defaults/
user_relationship_defaults.module, line 226 - Drupal Module: User Relationship Defaults
Code
function user_relationship_defaults_user($type, &$edit, &$account, $category = NULL) {
if ($type == 'insert' && $account->status || $type == 'after_update' && $account->status && !$account->login) {
//note that if a new account is approved, then blocked and unblocked before the user logged in once,
//it'll attempt to create default relationships again (there won't be any errors if they already exist, though)
$defaults = user_relationship_defaults_load();
foreach ($defaults as $default) {
user_relationships_request_relationship($default->user, $account, $default->relationship_type, TRUE);
}
}
//delete our default user if they are deleted from the site
if ($type == 'delete') {
db_query("DELETE FROM {user_relationship_defaults} WHERE uid = %d", $account->uid);
}
}