|
Cookbook /
UBBThreadsIntegrationSummary: How to use the user authentification of the UBBThreads forums to control access to a PmWiki installation
Version: 2006.01.30
Prerequisites: Requires at least PmWiki version: 2.1beta20; last tested on PmWiki version: 2.1beta20
Status:
Maintainer: Anno
QuestionHow can I use the user authentification of the UBBThreads forums ( http://www.ubbcentral.com/ubbthreads/(approve links) ) to control the access to my pmwiki installation? AnswerThis recipe enables all registered users on a UBBThreads forum to edit the wiki pages. The wiki pages in the Site group can only be edited by the users with the status administrator. The recipe currently requires to edit the pmwiki.php file, as it wouldn't work when included only from the config.php file. Installation instructions1. create a file called ubbauth.php with this content:
<?php
//UBBThreads authentication
$pos = strpos($_SERVER['REQUEST_URI'], "?action=edit");
if (is_numeric($pos)){
require_once("/path/to/your/forum/includes/main.inc.php");
$userob = new user;
$user = $userob -> authenticate();
if (!$user['U_Username']){
$html = new html;
$html->not_right("<br />You have to be registered and logged in
at the Forums
in order to edit this wiki document.<br /><br />
1.) First <a href='{$config['phpurl']}/login.php' target='_blank'>click here</a>
to open a new window where you can log in at the BB,
(leave that window open after you logged in)<br />
2.) Then <a href='{$_SERVER['REQUEST_URI']}'>click here</a> to edit the wiki page.");
exit;
}
}
Modify /path/to/your/forum/includes/main.inc.php to fit your forum. Copy the file ubbauth.php to the pmwiki 'local' directory. 2. Add this to your config file: $DefaultPasswords['edit'] = ($user['U_Username']) ? '' : '*'; $DefaultPasswords['admin'] = ($user['U_Status'] == 'Administrator') ? '' : '*'; $Author = $user['U_Username']; 3. Add this to the top of the pmwiki.php file, after <?php :
require_once('local/ubbauth.php');
4. Edit Site.EditForm and [=(:input e_author:)=] with:
[={$Author}=]
NotesReleasesAnno 2006-1-30 Version 1.0 CommentsI've used this integration sucessfully, altho with a couple of modifications. As I don't want just anyone to start editing our wiki, I've made ubbauth.php check wherther the user is a member of a group in Ubb. The changes made are the following: Ah, right, this was an error on my part above, thanks, fixed.
See AlsoContributors |