type == 'raamat') {
$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 raamat on lisatud.
");
$body .= t("Vaadata/Muuda saab ")."".t('siin').".";
$message = array(
"to" => $to,
"subject" => t("Uus raamat"),
"body" => $body,
"from" => $from,
"headers" => $default_headers
);
drupal_mail_send($message);
drupal_set_message(t("Thank you, book will become active during 24h!"));
}
break;
}
}
function raamatumaailm_kirjastaja_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
$user = user_load(array("uid" => $account->uid));
if (!empty($user->profile_kirjastus)) {
$roles = array("4" => "kirjastaja");
$edit['roles'] = $roles;
$changes = array('status' => 0, 'roles' => $roles, 'pass' => '123');
user_save($user, $changes);
$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 kirjastaja on registreerinud.
");
$body .= t("Kirjastaja andmed:
");
$body .= t("Kasutaja ID: ").$user->uid."
";
$body .= t("Kasutajanimi: ").$user->profile_username."
";
$body .= t("Kirjastus: ").$user->profile_kirjastus."
";
$body .= t("Kirjastaja aktiveerida saab ")."".t('siin').".";
$message = array(
"to" => $to,
"subject" => t("Uus kirjastaja"),
"body" => $body,
"from" => $from,
"headers" => $default_headers
);
drupal_mail_send($message);
}
break;
}
}
?>