2

I frequently need to delete all comments/posts of a particular abusive user. It takes a hell of time to accomplish this with a browser. It would be great if someone could tell me how to do it using drush.

3

You could run something like this via drush php-script:

<?php
global $user;
$user = user_load(1);
$result = db_query("SELECT nid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE u.name = '%s'", 'alice');
while ($row = db_fetch_object($result)) {
  node_delete($row->nid);
}
?>

There's also http://drupal.org/project/user_delete.

| improve this answer | |
  • I probably don't need to try the script, as the 'User Delete' module seems to be exactly what I was looking for. Thanks Dylan. – alfish Aug 24 '11 at 3:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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