| 1 |
<?php |
<?php |
| 2 |
// $Id: user_edit_notify.module,v 1.1 Thu Dec 20 21:32:41 EST 2007 davistv Exp $ |
// $Id: user_edit_notify.module,v 1.0 2007/12/08 13:31:54 davistv Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 6 |
* Notifies administrator of user profile modifications. |
* Notifies site_mail of user profile modifications. |
| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
/** |
/** |
| 10 |
* Implementation of hook_user(). |
* Implementation of hook_user(). |
| 11 |
*/ |
*/ |
| 12 |
function user_edit_notify_user($op, &$edit, &$account, $category = NULL) { |
function user_edit_notify_user($op, &$edit, &$account, $category = NULL) { |
| 13 |
switch ($op) { |
switch ($op) { |
| 14 |
case 'after_update': |
case 'after_update': |
| 17 |
$subject = t('Edited account details for !username at !site', array('!username' => $account->name, '!site' => variable_get('site_name', 'Drupal'))); |
$subject = t('Edited account details for !username at !site', array('!username' => $account->name, '!site' => variable_get('site_name', 'Drupal'))); |
| 18 |
$to = $from = variable_get('site_mail', ini_get('sendmail_from')); |
$to = $from = variable_get('site_mail', ini_get('sendmail_from')); |
| 19 |
$body = t("!user (!uri) has edited their profile.\n\n!edit-uri", array('!uri' => url("user/$account->uid", NULL, NULL, TRUE), '!user' => $account->name, '!edit-uri' => url("user/$account->uid/edit", NULL, NULL, TRUE))); |
$body = t("!user (!uri) has edited their profile.\n\n!edit-uri", array('!uri' => url("user/$account->uid", NULL, NULL, TRUE), '!user' => $account->name, '!edit-uri' => url("user/$account->uid/edit", NULL, NULL, TRUE))); |
| 20 |
|
|
| 21 |
$body .= "\n\nAccount Information:\n\n"; |
$body .= "\n\nAccount Information:\n\n"; |
| 22 |
|
|
| 23 |
$body .= "Email: " . $account->mail . "\n\n"; |
$body .= "Email: " . $account->mail . "\n\n"; |
| 24 |
|
|
| 25 |
$result = db_query('SELECT * FROM {profile_fields} ORDER BY category, weight'); |
$result = db_query('SELECT * FROM {profile_fields} ORDER BY category, weight'); |
| 26 |
while ($field = db_fetch_object($result)) { |
while ($field = db_fetch_object($result)) { |
| 27 |
$options[$field->name] = $field->title; |
$options[$field->name] = $field->title; |
| 29 |
foreach ($options as $key => $value) { |
foreach ($options as $key => $value) { |
| 30 |
$body .= $value . ": " . $account_info->$key . "\n\n"; |
$body .= $value . ": " . $account_info->$key . "\n\n"; |
| 31 |
} |
} |
| 32 |
|
|
| 33 |
drupal_mail( |
drupal_mail( |
| 34 |
'user-edit-notify-admin', |
'user-edit-notify-admin', |
| 35 |
$to, |
$to, |