I have the simple LDAP module installed and running, and I would like to prevent Drupal from creating a new user after a user authenticates if it does not already exist in Drupal.

I found the function 'simple_ldap_user_load_or_create_by_name', if (!$Drupal_user) ...

I cannot find a hook to modify this function, no way to do it without changing the module?

  • Are you wanting to allow those users to have access to the site but have no user object in the database, or do you want to deny them access entirely?
    – acrosman
    May 18, 2016 at 22:32
  • I would like to create the users with LDAP credentials by an administrator from the backend, not directly from the login form
    – carlo
    May 18, 2016 at 22:38

2 Answers 2


As you are describing it, this is not possible. You can limit authentication and user creation to only LDAP accounts, but you must have a local Drupal user.

  • Sure, but I wish the local Drupal users are created only by the backend and not from the login mask. With the Simple LDAP module when a user authenticates if the user does not exist in Drupal he creates, this thing I would like to avoid it. So you can only authenticate the users previously already created in Drupal by a amministartore.
    – carlo
    May 19, 2016 at 5:19

The Simple LDAP module's Simple LDAP Role submodule probably allows you to do something that would achieve the result you want (only a few people have more access than anonymous users). You can create a role in Drupal for privileged users, map that role to a group in LDAP, and then map everyone else to Authenticated user. If the authenticated user role has the same permissions as Anonymous you will have a very similar effect. That module might also allow you to control which groups can authenticate at all.

To have more features and more control you likely will need to create a custom submodule or switch to the larger LDAP module. The LDAP Module is powerful and useful, but not the best supported module in the community.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.