You are here

function hook_redhen_contact_user_update in RedHen CRM 7

Act on the contact when the link to a drupal user account is modified

Parameters

string $op ( insert | update | delete ):

$contact: The RedhenContact object with the new user drupal user info

$old_contact: The RedhenContact object with the old user info

Return value

void

2 invocations of hook_redhen_contact_user_update()
RedhenContactEntityController::deleteUser in modules/redhen_contact/lib/redhen_contact.controller.inc
Delete or unlink the active user for a contact.
RedhenContactEntityController::setUser in modules/redhen_contact/lib/redhen_contact.controller.inc
Set the active user for a contact.

File

./redhen.api.php, line 39
Hooks provided by the RedHen contact module.

Code

function hook_redhen_contact_user_update($op, RedhenContact $contact, $old_contact = NULL) {

  // Send "Welcome (no approval required)" email to new user.
  if ($op == 'insert') {
    $wrapper = entity_metadata_wrapper('redhen_contact', $contact);

    // Set _user_mail_notify specific operation.
    $op = 'register_no_approval_required';

    // Send an email.
    _user_mail_notify($op, $wrapper->user
      ->value());
  }
}