function _user_import_send_email in User Import 5
Same name and namespace in other branches
- 8 supported/user_import.inc \_user_import_send_email()
- 5.2 supported/user_import.inc \_user_import_send_email()
- 6.4 supported/user_import.inc \_user_import_send_email()
- 6.2 supported/user_import.inc \_user_import_send_email()
- 7.3 supported/user_import.inc \_user_import_send_email()
- 7 supported/user_import.inc \_user_import_send_email()
- 7.2 supported/user_import.inc \_user_import_send_email()
1 call to _user_import_send_email()
- user_import_user_import_after_save in supported/
user_import.inc - Implementation of hook_user_import_after_save().
File
- supported/
user_import.inc, line 27
Code
function _user_import_send_email($account, $password, $profile, $subject, $body, $format, $css, $subscribed) {
global $base_url;
$variables = array(
'!username' => $account->name,
'!uid' => $account->uid,
'!site' => variable_get('site_name', 'drupal'),
'!login_url' => user_pass_reset_url($account),
'!password' => $password,
'!uri' => $base_url,
'!uri_brief' => drupal_substr($base_url, drupal_strlen('http://')),
'!mailto' => $account->mail,
'!date' => format_date(time()),
'!login_uri' => url('user', NULL, NULL, TRUE),
'!edit_uri' => url('user/' . $account->uid . '/edit', NULL, NULL, TRUE),
);
_user_import_publication_email($variables, $account, $subscribed, $format);
// import info to profile
if (module_exists('profile') && is_array($profile)) {
$profile_name = _user_import_profile('fid', 'name');
while (list($fid, $field_name) = each($profile_name)) {
$variables['!' . $field_name] = $profile[$fid];
}
}
$subject = empty($subject) ? _user_mail_text('welcome_subject', $variables) : strtr($subject, $variables);
$body = empty($body) ? _user_mail_text('welcome_body', $variables) : strtr($body, $variables);
$headers = array();
if ($format == 1) {
$headers['Content-Type'] = 'text/html; charset=UTF-8; Content-transfer-encoding: 8Bit';
$body_head = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
if (!empty($css)) {
$body_head .= '<style type="text/css">' . check_plain($css) . '</style>';
}
$body = $body_head . '</head><body>' . $body . '<body></html>';
}
$sent = drupal_mail('user_import', $account->mail, $subject, $body, NULL, $headers);
return;
}