I'm guessing the main blocker with this was the confirm form. I'll take a look to see if this can be done :)

Comments

MrMaksimize’s picture

Attaching first run at a patch here. Wasn't sure what was going on with the sql statements, but it works fine for me without those.

coderintherye’s picture

Status: Active » Needs work

This is a good effort and works fairly well, but in order for this to be ready to go in, could you

1) Add some info to the delete_all_drush_command which will tell us that we can also do a delete-all users in addition to content types.
2) Can you test what happens if you do drush delete-all users when you have a content type called "users"? Seems like this could conflict
3) Try to make your patches so they ignore whitespace changes, there were a bunch of empty line changes in the patch, might be because you had tabs set? Use 2 spaces and no tabs.

Thanks!

Also, when you post your new patch, change the status to "Needs Review"

MrMaksimize’s picture

For sure!! Thanks for the tips!! (/me still new at making good patches). I'll spin up a brand new d7 site in the next day or 2 and make sure to get everything up to par :)
As for the tabs, you're right I think it might've been my ide ;(

coderintherye’s picture

Status: Needs work » Needs review
StatusFileSize
new1.41 KB

Here's an updated patch. If someone wants to review it I can commit it. I'd like to see the ability to delete by role as well...

MrMaksimize’s picture

@coderintherye sorry man got sick that weekend and then completely forgot. I just tested the patch on a clean d7 site with a bunch of nodes in content-type called users and also a bunch of actual users and it works great!! Sorry for the slack :(

coderintherye’s picture

Status: Needs review » Reviewed & tested by the community

No problem. I'll go ahead and commit this in then and attribute it to you. Thanks!

MrMaksimize’s picture

Cool.. Let me know when u do :) I started working off your patch - almost ready with the roles :)

MrMaksimize’s picture

Okely doke one more run - building on the patch above to also pick roles... Learning some cool stuff about drush in this issue :)

MrMaksimize’s picture

Status: Reviewed & tested by the community » Needs review

Setting back to needs review

coderintherye’s picture

Cool thanks! I'll try applying it later and see what happens.

alibama’s picture

this seems very useful - any chance of a backport?

coderintherye’s picture

Status: Needs review » Needs work

Sorry this took a long time to review.

Setting back to needs work because when I tried:

drush delete-all users --roles

and then selected admin, it deleted user 1.

I think we should follow the same behavior as drush delete-all users which is to *not* delete user 1.

Ideally, this could also work as drush delete-all users --roles=admin

Also, if possible, I'd love to have some help documentation in here, but that could be in a separate ticket.

coderintherye’s picture

@ #11 I won't be doing any backports to 6.x sorry, solely working on 7.x cause that is all I have time for. Though once this ticket is resolved feel free to change to 6.x. and see if a 6.x. maintainer will backport it.

MrMaksimize’s picture

Ohh agreed. Will reroll :)

coderintherye’s picture

Status: Needs work » Fixed

Ok, this should be ready to go in the latest dev snapshot when it comes up, as I've just committed.

Now you can do

drush delete-users [role]

example: drush delete-users administrator

or you can pass a number of roles as comma-separated values

example: drush delete-users administrator,editors

Caveat: Can't delete users who are only "authenticated users" except to delete all users (as they technically don't have a role), though we can tackle that in another issue if someone has a need for it.

Status: Fixed » Closed (fixed)

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

zuernbernhard’s picture

Issue summary: View changes

Hm 3 years later:

$ drush delete-users

results ins:

The drush command 'delete-users' could not be found. Run `drush cache-clear drush` to clear the commandfile cache if you have installed new extensions.

zuernbernhard’s picture

Status: Closed (fixed) » Active
zuernbernhard’s picture

Status: Active » Closed (fixed)

sry, my fault works as designed

ponies’s picture

Status: Closed (fixed) » Needs work

Installed the latest dev commit, 2013-Sep-30.

Tried running drush da --roles users and always received the 'Deleted 0 users'.

The delete_all_users_delete function was being passed an integer, the rid, from delete_all_drush_delete. On line delete_all.module:516 it uses the rid as the role name to try to find the rid.

It's more efficient for delete_all_users_delete to accept rids than to pass it the role name and have it preform another database query. I don't see anywhere in the code where it's passing roles to delete_all_users_delete, but having it accept rids and role names might bork if a role name is an integer.

Because user_roles() is going to be called to populate the form, I propose that delete_all_users_delete only accept rids.

  • coderintherye committed b1aeafd on 8.x-1.x
    Issue #1434254 by MrMaksimize, coderintherye: Added Ability to delete...