It's better when it's simple

User Tools

Site Tools


authdrupal7 Plugin

Compatible with DokuWiki

Hrun, Detritus, Frusterick Manners, Elenor of Tsort

plugin Authenticate using Drupal 7 login credentials

Last updated on

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to authdrupal8

Tagged with authentication, drupal, drupal7, login, users


:!: Note: Wrong use of some settings can make your wiki unreachable. Be sure to read the full documentation before installing/activating the plugin.

:!: External requirements: This plugin requires the following additional components that must be installed separately:

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.


When using the plugin Dokuwiki will get the user and login information from a Drupal 7 database.

Users can login using their Drupal 7 login credentials. Registering and modifying users is not possible (and most likely will not be) as this functionality is provided by Drupal.
Dokuwiki will read user groups and memberships from the Drupal 7 database as well. Make sure you read the configuration instructions further below on this page.

Configuration and Settings

After installation and activation the plugin can be configured using the dokuwiki configuration page. Make sure you stick to the suggested order unless you know exactly what you do.

1. Plugin configuration

You will find an authdrupal7-section on your config page. Edit the following values:

  • server: this will most likely be localhost
  • user: mysql-username with at least reading access to the Drupal database
  • password
  • database: name of the drupal database on your mysql-server
  • charset: charset of the mysql-database
  • drupalPrefix: Prefix of your Drupal tables, e.g. mypre_, make sure it ends with an underscore
  • drupalRoot: Path to your Drupal installation, make sure it ends with an /

You have the possibility to change the SQL statements retrieving needed information. For most Drupal installations the default statements should work fine.

2. ACL settings

Dokuwiki will use the Drupal roles as usergroups. To get the correct permissions for your users you have to edit the ACL settings.

When granting permissions the user group names are replaced with Drupal role names. If you want to grant access to all Drupal users that are members of the role wiki use the user group name @wiki.

3. Authentication

Go to the authentication section of the configuration page.

  • Add at least one valid Drupal role or Drupal username to the superuser list e.g. @administrator. I highly recommend that you are part of this group as this will be necessary to access the administration section afterwards. :!: I highly recommend to keep @admin as well, so you can easily switch back to authplain.
  • You might add valid Drupal roles/usernames to the managers list.
  • Afterwards set the authentication method to authdrupal7.

About Drupal roles

I highly recommend that you create new Drupal roles for use in your Dokuwiki permissions. Doing this you will be able to grant or deny wiki permissions without affecting your drupal permission. Not neccessarily should every Drupal admin have superuser rights in Dokuwiki. Create and assign this roles using Drupal administration tools.

Configuration details

SQL statements (defaults)


SQL statement for retrieving the password hash for a given user for downstream comparison.

SELECT pass FROM %{drupal_prefix}users WHERE name=\'%{user}\'

It is mandatory that the returned hash comes in a field named pass.


SQL statement to retrieve information about a given user.

SELECT name, mail FROM %{drupal_prefix}users WHERE name=\'%{user}\'

It is mandatory that the returned values come in fields named name and mail.


SQL statement to retrieve a given users role memberships.

SELECT FROM %{drupal_prefix}users users INNER JOIN %{drupal_prefix}users_roles userroles INNER JOIN %{drupal_prefix}role roles WHERE users.uid = userroles.uid AND roles.rid = userroles.rid AND = \'%{user}\'

It is mandatory that the returned values come in a field named name.


SQL statement to retrieve the number of non-deactivated user accounts.

SELECT COUNT(*) AS num FROM %{drupal_prefix}users WHERE status = 1

It is mandatory that the returned value comes in a field named num.


The authdrupal7 plugin widely bases on the authmysql plugin by Andreas Gohr.

Some changes were neccessary as Drupal uses some algorithms for hashing passwords that were not realizable using the authmysql plugin. The plugin includes these methods from the Drupal 7 installation.

Change Log

Bug Tracking


Compatibility with PHP7 is proposed in pull-request by user miroj

plugin/authdrupal7.txt · Last modified: 2020-01-26 17:00 by miroj

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki