Hello, I tried searching for information on google to delete all blocked users (for spam) with a drush command, I've also seen the documentation on drush.ws:

user-add-role Add a role to the specified user accounts.
user-block Block the specified user (s).
user-cancel Cancel a user account With The specified name.
user-create Create a user account With The specified name.
user-information Print information about the specified user (s).
user-login Display a one time login link for the Given user account (defaults to uid 1).
user-password (Re) Set the password for the user account With The specified name.
user-remove-role Remove a role from the specified user accounts.
user-unblock Unblock the specified user (s).

I have not seen it so I created a drush command to delete all blocked users.

I leave here the files since I have little experience with this and is prepared so that decompressing in the directory
sites / all /

This creates a folder called drush.
Drush read so hence the new command.

The command is "drush delete_block_users" and its alias dbu.

My question is how could integrate better with drush?
Thanks for everything.

Greetings.

Drush status.

 Drupal version         :  7.22                                                           
 Site URI               :  http://default                                                 
 Database driver        :  mysql                                                          
 Database hostname      :  localhost                                                      
 Database username      :  d7user                                                         
 Database name          :  d7devel                                                        
 Database               :  Connected                                                      
 Drupal bootstrap       :  Successful                                                     
 Drupal user            :  Anonymous                                                      
 Default theme          :  bartik                                                         
 Administration theme   :  seven                                                          
 PHP configuration      :  /Applications/XAMPP/xamppfiles/etc/php.ini                     
 Drush version          :  5.7                                                            
 Drush configuration    :                                                                 
 Drush alias files      :  /Users/miguelserranocabeza/.drush/vayapais.aliases.drushrc.php 
 Drupal root            :  /Applications/XAMPP/xamppfiles/htdocs/devel7                   
 Site path              :  sites/default                                                  
 File directory path    :  sites/default/files                                            
 temp                   :  /Applications/XAMPP/xamppfiles/temp/ 

Drush dbu --debug

Bootstrap to phase 0. [0.01 sec, 2.12 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.02 sec, 2.24 MB] [bootstrap]
Cache HIT cid: 5.7-commandfiles-0-44d1a70846951d712e444b82e822d9fe [0.03 sec, 2.25 MB]                 [debug]
Bootstrap to phase 0. [0.08 sec, 4.92 MB]                                                          [bootstrap]
Bootstrap to phase 5. [0.09 sec, 4.92 MB]                                                          [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.1 sec, 4.93 MB]                          [bootstrap]
Initialized Drupal 7.22 root directory at /Applications/XAMPP/xamppfiles/htdocs/devel7 [0.14 sec,     [notice]
6.76 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.14 sec, 6.76 MB]                         [bootstrap]
Initialized Drupal site default at sites/default [0.14 sec, 6.77 MB]                                  [notice]
Cache HIT cid: 5.7-commandfiles-2-c32acd775c18a90c5b41d0fc9accf5ab [0.15 sec, 6.77 MB]                 [debug]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.15 sec, 6.77 MB]                [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.16 sec, 6.77 MB]                     [bootstrap]
Successfully connected to the Drupal database. [0.16 sec, 6.78 MB]                                 [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.16 sec, 7.22 MB]                         [bootstrap]
Cache HIT cid: 5.7-commandfiles-5-1d8dcdb4ac6fef292922ae281c5c7484 [0.46 sec, 23.64 MB]                [debug]
Found command: delete_block_users (commandfile=delete_block_users) [0.47 sec, 24.2 MB]             [bootstrap]
Delete 0 block users. [0.53 sec, 24.5 MB]                                                          [success]
Command dispatch complete [0.54 sec, 24.45 MB]                                                        [notice]
 Timer  Cum (sec)  Count  Avg (msec) 
 page   0.384      1      383.91     

Peak memory usage was 25.47 MB [0.54 sec, 24.44 MB] 
CommentFileSizeAuthor
drush-delete-block-users.zip403.73 KBAnonymous (not verified)

Comments

moshe weitzman’s picture

Status: Active » Fixed

drush 5 and 6 have a --delete option for the user-cancel command (Drupal 7 only).

In the future, please ask support questions on Drupal Answers and contribute code or report bugs on Github The drupal.org issue system is no longer used.

Anonymous’s picture

thk moshe.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.