You are here

function messaging_mail_update_user in Messaging 6.4

Same name and namespace in other branches
  1. 7 messaging_mail/messaging_mail.module \messaging_mail_update_user()

Update destinations when a user account is updated, created

The destinations for that mail account will be assigned to the user

1 call to messaging_mail_update_user()
messaging_mail_user in messaging_mail/messaging_mail.module
Implementation of hook_user().

File

messaging_mail/messaging_mail.module, line 108
Simple mail using Drupal API. Messaging method plug-in

Code

function messaging_mail_update_user($account) {
  if ($account->status) {

    // Update mail for destinations of this user
    db_query("UPDATE {messaging_destination} SET address = '%s' WHERE uid = %d AND type = 'mail'", $account->mail, $account->uid);

    // Update uid for destinations with this mail
    db_query("UPDATE {messaging_destination} SET uid = %d WHERE uid = 0 AND type = 'mail' AND address = '%s'", $account->uid, $account->mail);
  }
}