You have many users blocked by spam? hundreds, thousands?
This small module will allow you to delete them all at once.

You can also do it with drush.
Delete all users block.
------------------
'drush del_block_user' o with alias 'drush dbu'

Delete all users block with argument (no delete de user con uids).
-------------------------------------------------------
drush dbu 4,5,8

Delete block users

https://drupal.org/sandbox/lgrtm/2074157

Similar projects.

Logintoboggan
https://drupal.org/project/logintoboggan

Delete all
https://drupal.org/project/delete_all

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Issue summary: View changes

Upload Pics and info.

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

jlbellido’s picture

Status: Needs review » Needs work

It seems that the default branch is 7.x but if we check the project with Ventral (http://pareview.sh/pareview/httpgitdrupalorgsandboxlgrtm2074157git) :
"There is still a master branch, make sure to set the correct default branch: http://drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in http://drupal.org/node/1127732 "

Anonymous’s picture

Status: Needs work » Needs review

Ok, thk for reply and tip!

I remove the master branch and test in pareview.
All ok!.

Have you found any error or it's all right?
Thk.
Bye

Vik’s picture

FILE: del_block_users.module
--------------------------------------------------------------------------------
FOUND 9 ERROR(S) AND 2 WARNING(S) AFFECTING 9 LINE(S)
--------------------------------------------------------------------------------
57 | ERROR | Functions must not contain multiple empty lines in a row; found
| | 2 empty lines
60 | ERROR | Comment indentation error, expected only 1 spaces
64 | WARNING | There must be no blank line following an inline comment
65 | ERROR | Functions must not contain multiple empty lines in a row; found
| | 2 empty lines
68 | WARNING | There must be no blank line following an inline comment
68 | ERROR | No space before comment text; expected "// =
| | array_diff_assoc($users, $usersexclude);" but found "//=
| | array_diff_assoc($users, $usersexclude);"
68 | ERROR | Comments may not appear after statements.
78 | ERROR | No space before comment text; expected "// dpm($users);" but
| | found "//dpm($users);"
79 | ERROR | No space before comment text; expected "// dpm($usersexclude);"
| | but found "//dpm($usersexclude);"
80 | ERROR | No space before comment text; expected "// dpm($users);" but
| | found "//dpm($users);"
96 | ERROR | Files must end in a single new line character
--------------------------------------------------------------------------------

Anonymous’s picture

Status: Needs review » Needs work

Hi Vik, thks for follow.

I checked with the new branch and it´s all ok.
It´s the last branch ?

Coder module
------------
SITES/ALL/MODULES/DEL_BLOCK_USERS/DEL_BLOCK_USERS.MODULE
del_block_users.module

No Problems Found
SITES/ALL/MODULES/DEL_BLOCK_USERS/DRUSH/DEL_BLOCK_USERS.DRUSH.INC
del_block_users.drush.inc

No Problems Found

git clone --branch 7.x-1.x lgrtm@git.drupal.org:sandbox/lgrtm/2074157.git del_block_users

Anonymous’s picture

Status: Needs work » Needs review

New status, sorry.

Anonymous’s picture

Issue summary: View changes

Info review.

Anonymous’s picture

Issue summary: View changes

Similar projects.

alexmoreno’s picture

Status: Needs review » Needs work

this module looks like it could work very nicely in combination with mine: https://drupal.org/node/2083831 :-)

Please, add instructions on how to clone your project: git clone http://git.drupal.org/sandbox/lgrtm/2074157.git del_block_users

Is the user in the README pointing to the wrong Drupal User? http://drupal.org/user/5546

The module installs correctly and works fine. Tested with a blocked user, selecting the user to avoid deletion and without selecting it works properly. The code is also well written and documented, nothing else to comment in that.

Help us with some reviews to accelerate your review process. You can help me too :-): https://drupal.org/node/2083831

Once done this, I think it could be ready :-).

bappa.sarkar’s picture

Manual Review

1. The Erase Confirmation should be in separate form (Should work like confirm form)

2. You should explode and trim the uids in

$usersexclude = explode(',', $form['del_block_users']['selectusers']['#value']);

replace with

$usersexclude = array_map('trim', explode(",", $form['del_block_users']['selectusers']['#value']));

3. To exclude users from delete list you have used

foreach ($usersexclude as $user) {
    if (in_array($user, $users)) {
      $key_users = array_search($user, $users);
      unset($users[$key_users]);
    }
  }

This is very time consuming. You can use below

$users = array_diff($users, $usersexclude);

4. To delete user you user foreach

foreach ($users as $user) {
      db_delete('users')
      ->condition('uid', $user)
      ->execute();
    }

This is again very time consuming. You can use below

db_delete('users')
      ->condition('uid', $users, 'IN')
      ->execute();

All blocked users will be deleted in a single query.

5. I am feeling the exclude uid fiels title should be easy to understand in

'#title' => t('Select id of block user to no delete.'),

it can be something like below

'#title' => t('Select user ids from blocked users to exclude from deletion.'),
Anonymous’s picture

Hi Vik, have you intented now ?
Thk.

Miguel.

Anonymous’s picture

Hello Bappa.sarkar , thank you very much for your review. I learned from it.
I am new to this as my English :)

I am very happy with your proposal and help.
Now I get to it.

Thank you.
Greetings.

Anonymous’s picture

Thk too to urwen for test this module, i can help with reviews too.
Bye !

Anonymous’s picture

Status: Needs work » Needs review

Apply changes proposal for comunity.
Thk.

PD. I need review info for task proposal -> 1. The Erase Confirmation should be in separate form (Should work like confirm form).

swim’s picture

Status: Needs work » Needs review

Hey lgrtm,

I'll just do a quick review with your FAPI implementations.

In del_block_users.module line 10, function del_block_users_form_alter;

  1. Why are you passing the form_state by reference?
  2. Don't return $form.

Have a look at hook_form_FORM_ID_alter as your only targeting a single form.

So something like;

/**
 * Implements hook_form_alter().
 */
function del_block_users_form_user_filter_form_alter(&$form, &$form_state) {

}

Lastly your CSS can be attached to your form like so.

$form['#attached']['css'][] = $path . '/del_block_users.css';

Just a suggestion but consider adding a validation function.

Cheers,

swim’s picture

Status: Needs review » Needs work

Updated status.

Anonymous’s picture

Hi all, i renew code and inmplement validation in the field.
Clarify instructions in readme for clone it.

Thk
Cheers.

gaurav.pahuja’s picture

Module working fine for me.
Here is one monor comment:
Please add dt function for 'description' string inside hook_drush_command

gaurav.pahuja’s picture

Issue summary: View changes

Cancel similar project, only D6.

iamrasec’s picture

Module seems to be working fine on my tests also. Just curious though, what is that "checkbox," file in your module? I'm thinking it was included there by accident?

Anonymous’s picture

Thk iamrasec!

Ah sorry all, i new with git and how i see i have more commits for a little coder here.
I starting with any problem with it.

I will erase it.
Thk.

PD. i have the confirm form prepared but now i dont have validate.
This night i uploader for helpme!!!

Thk
Cheers.

iamrasec’s picture

Understandable. I too am new to git also. Anyway, you don't seem to have any problems here also: http://pareview.sh/pareview/httpgitdrupalorgsandboxlgrtm2074157

So other than that rogue file, this module seems to be good to go.

Enxebre’s picture

Hi,
manual review:
1 - In file "del_block_users.module", line 40

current_path() . '/del_block_users.css';

is returning "admin/people/del_block_users.css"

I think this is what you are looking for:

drupal_get_path('module', 'del_block_users') . '/del_block_users.css';

2 - As iamrasec says there is a file calle checkbox.

3 - In your submit function You could considering to add a "where clause" to the query instead of retrieving unuseful elements and then make an "array_diff" which probably will become in a poorer perfomance.

4 - Doctumentation says:
Note: in 90% of select query use cases you will have a static query. If in a critical performance path, you should use db_query() and friends instead of db_select() for performance reasons. Only use dynamic queries if the query parts vary (example: adding WHERE conditions depending on the context) or if they should be alterable
https://drupal.org/node/310075

5 - When I execute some drush command with an invalid argument ("drush cc asdasdad" or "drush vget asgdjagdjagsj") I have the next message:

"Delete all block users in site, caution for manual block user. You can select uid for no delete."

Hope this help.

Regards.

Anonymous’s picture

Very thk for great review and help, i will check all points.
Regards.

coredumperror’s picture

Status: Needs review » Needs work
Issue tags: -drush, -admin, -delete users
FileSize
4.41 KB

This looks like a nice, straightforward module for removing all those pesky auto-blocked users. However, there are several confusing grammar errors in this module, most seriously in the title itself.

From what I can tell, this module should be called "Delete Blocked Users". Without that "ed", the module's name sounds like it's related to Drupal's Block system (the admin/structure/block page), rather than to blocked user accounts. This is a common conjugation mistake for ESL users, so don't feel bad. :)

I've also included a patch that fixes up the grammar of all the user-visible strings in the module. My patch doesn't change the name of the module, though, because the name is so closely tied to the file and function names. That would be a really significant change that I figured should be done by lgrtm, if he decides to do so.

Additionally, my patch tweaks the del_block_users_validate() to be more robust. It now supports whitespace between the comma-separated numbers, and has a slightly more readable regex.

Anonymous’s picture

Hi all people, sorry for this long time with no update.

Now i have a few time for continue with this.

Very thk coredumperro for feedback !!! Is a clearly condition in the name of module, i will change it.
This week i test it and modify it.

Bye and greets !

Anonymous’s picture

Issue summary: View changes

New similiar module.

PA robot’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application (see also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.