Skip to content

Instantly share code, notes, and snippets.

@signalpoint
Forked from gavinblair/resend.php
Last active November 19, 2015 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save signalpoint/f17c645e44b9379d8320 to your computer and use it in GitHub Desktop.
Save signalpoint/f17c645e44b9379d8320 to your computer and use it in GitHub Desktop.
Drupal - resend welcome e-mails on users administration form.
<?php
/**
* Implements hook_user_operations().
*/
function example_user_operations() {
$operations = array(
'example_resend_welcome_email' => array(
'label' => t('Re-send welcome e-mail'),
'callback' => 'example_resend_welcome_email',
)
);
return $operations;
}
/**
*
*/
function example_resend_welcome_email($accounts) {
$accounts = user_load_multiple($accounts);
foreach ($accounts as $account) {
watchdog('example', 'Re-sent welcome e-mail to %mail.', array('%mail' => $account->mail));
drupal_set_message(t('Re-sent welcome e-mail to %mail', array('%mail' => $account->mail)));
$op = 'register_admin_created'; // @see https://api.drupal.org/api/drupal/modules!user!user.module/function/_user_mail_notify/7
_user_mail_notify($op, $account);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment