Apologies for the combined bug and feature request.

Our organization is looking to use a module like this for our production sites to help keep them secure. It looks like this module is fairly new, but it is the most relevant module for our needs.

Being new, it does not look like this module would be ready for a security review by the Drupal security team. I'm hoping to help push block_inactive_users to a production-ready release.

I will be submitting a patch shortly that adds a checkbox and function for removing users whose `Last Access` is never, and makes several formatting and code fixes.

Here's what the drupal-check tool found:

------ ----------------------------------------------------------------------
  Line   src\Controller\ReactivateUserController.php
 ------ ----------------------------------------------------------------------
  104    Call to deprecated function drupal_set_message():
         in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
  108    Call to deprecated function drupal_set_message():
         in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
 ------ ----------------------------------------------------------------------

 ------ ----------------------------------------------------------------------
  Line   src\InactiveUsersHandler.php
 ------ ----------------------------------------------------------------------
  191    Call to deprecated method url() of class Drupal:
         as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
         Instead create a \Drupal\Core\Url object directly, for example using
         Url::fromRoute().
 ------ ----------------------------------------------------------------------

 ------ ------------------------------------------------------------------------
  Line   tests\src\Unit\InactiveUsersHandlerTest.php
 ------ ------------------------------------------------------------------------
         Class Drupal\Tests\UnitTestCase not found and could not be autoloaded.
 ------ ------------------------------------------------------------------------

 [ERROR] Found 4 errors

Please also review the warnings on pareview: https://pareview.sh/pareview/https-git.drupal.org-project-block_inactive...

Hope I'm not stepping on toes, but I've taken it upon myself to fix and improve several things here, except for the deprecated call to `\Drupal::url` in InactiveUsersHandler.php. I can open a separate issue for that.

Comments

AdamBernstein created an issue. See original summary.

adambernstein’s picture

This patch updates the following:
- Checkbox/option to remove users who have never logged in
- Adds hook_help() and updates Readme.md
- Fix unused `use` statement and adjusts help text in SettingsForm
- Replace deprecated drupal_set_message() function with Messenger

adambernstein’s picture

StatusFileSize
new7.77 KB

Oops, I just realized my previous patch would not work. Updated here, use this one instead.

  • AdamBernstein authored 393aaf5 on 8.x-1.x
    Issue #3066831 by AdamBernstein: Option to block users who have never...
rawdreeg’s picture

Status: Active » Fixed

Thank you very much for you contribution. I have tested your patch (Thanks for resubmitting by the way) and I have added that in.

R

rawdreeg’s picture

Status: Fixed » Closed (fixed)