DokuWiki

From FUDforum Wiki
Jump to: navigation, search

DokuWiki can be integrated with FUDforum. This assumes that all user accounts will be created and maintained through FUDforum.

Code

The below solution was originally posted by Ben Ramsey on the DokuWiki website (see link below):

<?php
/**
 * Options to configure for a FUDforum database
 * http://fudforum.org/
 */

/**
 * Turn off registration on DokuWiki
 */
$conf['openregister'] = 0;

/**
 * Set the signature for all users
 *
 * This signature will link to the user's FUDforum profile. To make this work
 * correctly, add the following line to the conf/interwiki.conf file. Be sure
 * to replace "forum.example.org" with the hostname for your FUDforum 
 * installation. You may need to modify the path to index.php if you installed
 * FUDforum in a directory other than root. This also assumes you have 
 * PATH_INFO style URLs turned on in FUDforum.
 *
 *   user      http://forum.example.org/index.php/u/{PATH}/
 *
 * If you are not using PATH_INFO style URLs in FUDforum, use the following 
 * format in interwiki.conf:
 *
 *   user      http://forum.example.org/index.php?t=usrinfo&id={URL}
 *
 * Note that this relies on the getUserInfo query below that stores the user
 * id in the `mail` field instead of the actual e-mail address.
 */
$conf['signature'] = '//[[user>@MAIL@|@NAME@]] @DATE@//';

/**
 * Database connection parameters; change these for your environment
 */
$conf['auth']['mysql']['server']   = ;
$conf['auth']['mysql']['user']     = ;
$conf['auth']['mysql']['password'] = ;
$conf['auth']['mysql']['database'] = ;

/**
 * Send password in clear text to database
 */
$conf['auth']['mysql']['forwardClearPass'] = 1;

/**
 * Authenticate user by checking password
 */
$conf['auth']['mysql']['checkPass']= "SELECT passwd as `pass`
                                      FROM fud30_users
                                      WHERE login='%{user}' 
                                      AND passwd=MD5('%{pass}')";

/**
 * Get user info
 *
 * Note the use of "id AS `mail`". Instead of retrieving the user's email
 * address, I'm getting the ID for use with the user's DokuWiki signature
 * (see note on $conf['signature'] above). If you do not wish to use this
 * signature and would rather get the e-mail address, use "email" instead of
 * "id" in the query below.
 */
$conf['auth']['mysql']['getUserInfo'] = "SELECT passwd AS `pass`, login AS `name`, id AS `mail`
                                         FROM fud30_users
                                         WHERE login='%{user}'";

/**
 * Get groups to which user belongs
 *
 * Note the use of the UNION. This allows all registered users to be a member
 * of the default group (as defined in $conf['defaultgroup']) without the 
 * need to create a new group in FUDforum. Other groups may be created in 
 * FUDforum for "admin," etc.
 */
$conf['auth']['mysql']['getGroups'] = "SELECT fud30_groups.name AS 'group'
                                       FROM fud30_groups, fud30_users, fud30_group_members
                                       WHERE fud30_users.id = fud30_group_members.user_id
                                       AND fud30_groups.id = fud30_group_members.group_id
                                       AND fud30_users.login='%{user}'
                                       UNION 
                                       SELECT '" . $conf['defaultgroup'] . "' as `group`";
?>

External links

Languages
Personal tools