It's better when it's simple

User Tools

Site Tools



Configuration for authMySQL Auth plugin to authentication with e107, which let's do:

  • Only basic authentication
  • No user modification/adding. This assumes that all user accounts will be created and maintained through e107.

Tested on

  • e107 0.7.8
  • Dokuwiki 2007-06-26b
  • MySQL 4.1.15 and MySQL 5.0.45
  • php 4.3.11 and php 5.1.6


Use the Config Manager or add it to the conf/local.protected.php to store the config protected.

Change the table prefix when needed in the queries below (I have used the default e107_).

 * e107 configuration for MySQL Auth Plugin
 * See for details and explanation
// Activate MySQL auth plugin
$conf['authtype'] = "mysql";    // Set authentication backend to MySQL
$conf['passcrypt'] = "my411";   // password encryption my411 or mysql 
//$conf['passcrypt'] = "mysql"; //   (depending on the version of your MySQL DB)
      array("e107_user", "e107_user AS u", "e107_userclass_classes");
$conf['plugin']['authmysql']['checkPass']   = 
     "SELECT user_password AS pass
      FROM e107_user
      WHERE user_loginname='%{user}'";
$conf['plugin']['authmysql']['getUserInfo'] = 
     "SELECT user_password AS pass, user_name AS name, user_email AS mail
      FROM e107_user
      WHERE user_loginname='%{user}'";
$conf['plugin']['authmysql']['getGroups']   = 
     "SELECT userclass_name as `group`
      FROM e107_user, e107_userclass_classes
      WHERE FIND_IN_SET(e107_userclass_classes.userclass_id, e107_user.user_class) <> 0
      AND e107_user.user_loginname='%{user}'
      SELECT 'admin' AS  `group`
      FROM e107_user AS u
      WHERE user_admin <> 0
      AND user_loginname='%{user}'
      SELECT 'user' AS `group`";


  • The getGroups query is slightly particular.
    • It consists of two SELECT statements, joined with a UNION statement. The first select finds all the userclasses the user belongs to in e107. It returns a list with these userclasses as groups to be used in DokuWiki. The second SELECT will add one more group (“admin”) to the list, if the user is defined as an admin in e107. This will enable you to have the same admins in your wiki as in e107. For this to work, you will have to add
      $conf['superuser'] = '@admin';

      to your config.

    • The last part of the UNION guarantees that every user with a valid login will land in the default group “@user”. This makes providing an exclusive wiki for all e107 users more easy.
    • The first SELECT statement uses an unusual FIND_IN_SET WHERE clause. This is because e107 doesn't use a separate table to store the user/group relationships. Instead, it uses a single field in the user table that contains a comma separated list of userclasses that user belongs to. As far as I know, FIND_IN_SET is available since MySQL 4.0.x.
  • Probably more of a general remark, but I'll put it here anyway because I came across it in my experiments: when setting up ACL's using this scheme, you may have to encode certain characters in your acl.auth.php file. For example, the groupname

    has to be encoded as


    The ACL admin interface on you DokuWiki site does this automatically for you, so using the webinterface is easiest way to setup your ACL's.

Geert Janssens 2008/10/05 14:53

plugin/authmysql/e107.txt · Last modified: 2013-02-10 14:35 by Klap-in

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