type == 'blog') {
$to = "aivar@raamatumaailm.ee";
//$to = "slav@testonica.com";
// Build the default headers
$default_headers = array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/html; charset=UTF-8;',
'Content-Transfer-Encoding' => '8Bit',
'X-Mailer' => 'Drupal'
);
$body = t("Uus arvustus on lisatud.
");
$body .= t("Vaadata/Muuda saab ")."".t('siin').".";
$message = array(
"to" => $to,
"subject" => t("Uus arvustus"),
"body" => $body,
"from" => $from,
"headers" => $default_headers
);
drupal_mail_send($message);
}
break;
}
}
function raamatumaailm_arvustaja_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
$user = user_load(array("uid" => $account->uid));
if (!empty($user->profile_raamatuarvustaja)) {
$roles = array("5" => "raamatuarvustaja");
$edit['roles'] = $roles;
$about = $user->profile_about;
$changes = array('profile_about' => '.', 'status' => 0, 'roles' => $roles, 'pass' => '123');
user_save($user, $changes);
$changes = array('profile_about' => '');
user_save($user, $changes, "Personal Information");
$from = "info@raamatumaailm.ee";
$to = "aivar@raamatumaailm.ee";
//$to = "slava@testonica.com";
// Build the default headers
$default_headers = array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/html; charset=UTF-8;',
'Content-Transfer-Encoding' => '8Bit',
'X-Mailer' => 'Drupal'
);
$body = t("Uus arvustaja on registreerinud.
");
$body .= t("Arvustaja andmed:
");
$body .= t("Kasutaja ID: ").$user->uid."
";
$body .= t("Kasutajanimi: ").$user->profile_username."
";
$body .= t("Kes ma olen: ").$about."
";
$body .= t("Arvustaja aktiveerida saab ")."".t('siin').".";
$message = array(
"to" => $to,
"subject" => t("Uus arvustaja"),
"body" => $body,
"from" => $from,
"headers" => $default_headers
);
drupal_mail_send($message);
}
break;
}
}
?>