Custom logic for disabling

Last updated on
19 November 2018

Outline

In some scenario's it might be useful to be able to disable the login check for user 1. One of the examples that came up is when you're having multiple servers (E.g. DEV/STAG/PROD) where you want to be able to login as user 1 on DEV and STAG but not on PROD. It's possible to override a configuration setting from the module to disable this check.

This is logic that you will need to implement in your own module and it's your own responsibility to make sure that it's working correctly on all your environments according to your logic.

Drupal 8

Since the module is using the Drupal 8 configuration API it's quite easy to disable or enable the check. An example can be found in the stop_admin_update_8001 hook.

\Drupal::configFactory()
  ->getEditable('stop_admin.settings')
  ->set('disabled', FALSE)
  ->save(TRUE);

Obviously if you want to disable the check you'll need to change FALSE to TRUE.

Drupal 7

An example can be found in the stop_admin_update_7001 hook.

variable_set('stop_admin_disabled', FALSE);

Obviously if you want to disable the check you'll need to change FALSE to TRUE.

Help improve this page

Page status: No known problems

You can: