function hosting_client_register_user in Hosting 5
Same name and namespace in other branches
- 6.2 client/hosting_client.module \hosting_client_register_user()
- 7.4 client/hosting_client.module \hosting_client_register_user()
- 7.3 client/hosting_client.module \hosting_client_register_user()
1 call to hosting_client_register_user()
- hosting_client_insert in client/
hosting_client.module - Implementation of hook_insert().
2 string references to 'hosting_client_register_user'
- hosting_client_configure in client/
hosting_client.module - hosting_client_insert in client/
hosting_client.module - Implementation of hook_insert().
File
- client/
hosting_client.module, line 242
Code
function hosting_client_register_user($node) {
//register a new user account for the client
$pass = user_password();
$user = new stdClass();
$edit['name'] = $node->email;
$edit['hosting_client'] = array(
$node->nid,
);
$edit['mail'] = $node->email;
$edit['pass'] = $pass;
$edit['status'] = 1;
$edit['roles'][_hosting_client_get_role()] = TRUE;
$user = user_save($user, $edit);
if ($user->uid && variable_get('hosting_client_send_welcome', FALSE)) {
if ($node->client_name) {
$to = sprintf("%s <%s>", $node->client_name, $node->email);
}
else {
$to = $node->email;
}
$variables = array(
'!username' => $user->name,
'!site' => variable_get('site_name', 'Drupal'),
'!password' => $pass,
'!uri' => $GLOBALS['base_url'],
'!uri_brief' => substr($base_url, strlen('http://')),
'!date' => format_date(time()),
'!login_uri' => url('user', NULL, NULL, TRUE),
'!edit_uri' => url('user/' . $account->uid . '/edit', NULL, NULL, TRUE),
'!login_url' => user_pass_reset_url($user),
);
// No e-mail verification is required, create new user account, and login user immediately.
$subject = _hosting_client_mail_text('welcome_subject', $variables);
$body = _hosting_client_mail_text('welcome_body', $variables);
drupal_mail('hosting-client-register-welcome', $to, $subject, $body);
}
}