Tuesday, 9 December 2008

Drupal notify all users...

We are working to get our new website up and running and migrated our old users into the drupal database. As we where also cleaning the database we mass mailed our users and asked them to reset their password.


To issue a 'resend my password, cause I forgot' on all our users aka reset all user passwords and notify, the little nifty script below is used, please do mind that drush is a module of drupal.



#!/bin/sh
drush --root=/usr/local/www/drupal6/sites/wirelessleiden.nl eval '
$sql = "SELECT uid FROM {users} WHERE uid != 0";
$language="nl";
$users = db_query($sql);
print "b" . $result;
while ($user = db_result($users)) {
$account = user_load(array("uid" => $user, "status" => 1));
print "Sending email to: " . $account->name . "\n";
_user_mail_notify("password_reset", $account, $language);
};

'


EDIT: Cool, blogger/blogspot includes syntax highlighting

No comments:

Post a Comment