[pmwiki-users] Simplemachines user system integration

Anno anno at shroomery.org
Fri Jan 20 17:43:51 CST 2006


> I would like to be able to use the authentication and user management 
> from Simple Machines Forum to control access to a PmWIki site, but 
> that is waaaayyyyy beyond my very limited PHP abilities.


This is a working example for simplemachines, it is just a working example and
can easily be modified for other actions or permissions.


It currently requires to edit the pmwiki.php file, as it wouldn't work when
included only from the config.php file. Perhaps Patrick can take a look at
it(perhaps by installing simplemachines on the server and figuring out what the
problem is).

The recipe:

1. create a file called forumauth.php with this content:

//Simplemachines authentification
require_once('/path/to/your/forum/SSI.php');
$pos = strpos($_SERVER['REQUEST_URI'], "?action=edit");
if (!$user_info['username'] && is_numeric($pos)){
	echo "You have to be registered and logged in at the Forums
			in order to edit this wiki document.<br /><br />

			1.) First  <a href='http://www.yoursite.com/forum/index.php?action=login'
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/SSI.php
and
http://www.yoursite.com/forum/index.php

to fit your forum  and  copy the file forumauth.php to the pmwiki  'local'
directory.

2. Add this to your config file:
$DefaultPasswords['edit'] = ($user_info['username']) ? '' : '*';
if ($user_info['is_admin']) $DefaultPasswords['admin'] = '';
$Author = $user_info['username'];

3. add this to the top of the pmwiki.php file, after <?php:
require_once('local/forumauth.php');

Optionally edit Site.EditForm and
replace:
(:input e_author:) 
with:
{$Author}

That's it.





More information about the pmwiki-users mailing list