I want to use the email_auto_login module. However it implements a hook_mail_alter which I don't want.

 * Implements hook_mail_alter().
function email_auto_login_mail_alter(&$message) {
  $user = user_load_by_mail($message['to']);

  // Don't add tokens for admin, anonymous or blocked.
  if (!isset($user->uid) || $user->uid == 1 || $user->status == 0) {

  $token = _email_auto_login_generate_token($user);

  foreach ($message['body'] as &$body) {
    $body = _email_auto_login_add_token($body, $token);

Is there a way to remove the hook without modifying the above code? I'm running Drupal7.

1 Answer 1


You should be able to do it with hook_module_implements_alter(&$implementations, $hook) in your module. Simply test $hook and if it is the hook you don't want implemented, unset($implementations['email_auto_login']).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.