Revision [11155]

This is an old revision of WikkaWithSMF made by TonZijlstra on 2005-09-22 15:25:12.

 

Wikka with Simple Machines Forum


This is still in the idea stage, although I am already testing some hacks on my local machine.

All help appreciated!

Aims:

  1. Replace the Wikka registration/login system with a bridge to the SMF forum membership system.
  1. Allow registered and logged-in SMF forum users to edit pages in Wikka
  1. Automatically camel-case SMF usernames for use in Wikka

Possible ways of acheiving this:

  1. Either using a similar hack to WikkaWithphpBB, or
  1. use the API (smf_api.php) that is supplied with SMF that allows us to call some standard routines like checking whether a user is logged in and return their username.

I am currently favouring method 2, which will probably be slightly more difficult but I think it will offer greater flexibility and tighter integration, we'll see...

(TonZijlstra)

We could work the other way around as well:
Aims:
  1. Replace the SMF registration page with a bridge from wikka registration page
  1. Allow registered and logged-in wikka users to use the forum (and none else)

I use a wikkasite where I want to include a SMF forum. So I'd like SMF to use the usernames and pw's from Wikka, and have Wikka log them into the forum when they log into the wiki. (same goes for editing rights in Wordpress weblog admintool)

Possible ways of achieving this:
  1. the two routes as stated above
  1. have Wikka set a cookie for SMF as well, as both rely on cookies for determining logged-in status.


UPDATE:
I've hacked together an extremely crude attempt of making the Wikka Login procedure run through SMF.
I am using it in a platform that is a combination of Wikka, SMF and two Wordpress blogs one of which is only accessible for logged on users. The user tables of these 4 modules already contain the same list of users and pw's. As no-one can register on the platform freely, the number of users is limited to around 20, and only the admin creates accounts it is easy to maintain those tables.

Also the only reason I go through the forum here is because setting the cookies for the forum from the wiki was to tedious and it was easier the other way around. I only wanted to give the users the impression of single sign on.

Next step is deleting all cookies that were set on log-out which is easily done from within wikka itself. Changing passwords is another matter, but as I said, in my case not a big problem, given the closed user group of only a few individuals.

I have altered the login script of SMF Loginout.php after where it says

// Bam!  Cookie set.  A session too, just incase.
	setLoginCookie(60 * $modSettings['cookieTime'], $user_settings['ID_MEMBER'], $md5_passwrd);



by adding
// setting cookies for both blogs as well for editing rights and the wiki
// first some variables
$passwordwp=md5(md5($_REQUEST['passwrd']));
$usernamewp=$_REQUEST[user];
$homewp1="http://www.weblogdomain1.com";
$homewp2="http://www.weblogdomain2.com";
$cookiepathwp1= preg_replace('|https?://[^/]+|i', '', $homewp1 . '/' );
$cookiepathwp2= preg_replace('|https?://[^/]+|i', '', $homewp2 . '/' );
$siteurlwp1=$homewp1;
$siteurlwp2=$homewp2;
$cookiehashwp1 = md5($siteurlwp1);
$cookiehashwp2 = md5($siteurlwp2);

// setting the cookies for two wordpress blogs
setcookie('wordpressuser_'. $cookiehashwp1, $usernamewp, time() + 31536000, $cookiepathwp1);
setcookie('wordpresspass_'. $cookiehashwp1, $passwordwp, time() + 31536000, $cookiepathwp1);
setcookie('wordpressuser_'. $cookiehashwp2, $usernamewp, time() + 31536000, $cookiepathwp2);
setcookie('wordpresspass_'. $cookiehashwp2, $passwordwp, time() + 31536000, $cookiepathwp2);

//variables for the wiki-cookies
$name1="wikka_user_name";
$name2="wikka_pass";
$wikiname=$_REQUEST['user'];
$wikipass= md5($_REQUEST['passwrd']);
// setting wikicookies
setcookie($name1, $wikiname, time() + 90 * 24 * 60 * 60, "/");
setcookie($name2, $wikipass, time() + 90 * 24 * 60 * 60, "/");


And a bit further down in the same file I added:

// redirect to wiki if that is where you came from
if (isset($_REQUEST[refer])) 
	   redirectexit('http://yourdomain.com/yourwikipage', false);


before where it says

// Just log you back out if it's in maintenance mode and you AREN'T an admin.


Next I altered usersettings.php in the Wikka actions:

replacing

// check password
			if ($existingUser["password"] == md5($_POST["password"]))
			{
				
							  
							  $this->SetUser($existingUser);
							  $this->Redirect($this->href());
			}


with

// check password
			if ($existingUser["password"] == md5($_POST["password"]))
			{
				
							  
							  $this->SetUser($existingUser);
							 // lets go through the forum
							  $forumurl = "http://yourdomain.com/forum/index.php?action=login2&user=".$_POST['name']."&passwrd=".$_POST['password']."&refer=wiki ";
							  $this->Redirect($forumurl);
							  //$this->Redirect($this->href());
			}


(TonZijlstra)

CategoryUserContributions
There are 6 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki