Extension:Discuz X Single Sign-On

This is tool for Chinese Forum: Discuz, I will write some Chinese in the rest.

这是一个真正的discusX2和mediawiki的同步登陆插件，不是用户共享，也不是UCenter自带的样例程序，只用一套登陆系统，用户登陆的通道就能双向打通.

This plugin is a hacked version of Extension:AuthUCenter and Extension:Phpbb Single Sign-On - It was used as the base for this, I just replaced all needed code to be specific to discuz

This is very beta - Please make any edits to this code to make it better. I probably will not keep the code curent, so please, take control.

Installation
This is an extension for mediawiki, 下载DiscusXSSO.tar.gz之后

添加应用


find

replace with

find

replace with

In &lt;forum directory&gt;/includes/session.php
find

replace with

In &lt;wiki directory&gt;/LocalSettings.php
Place the following lines in your LocalSettings.php file: This includes the plugin, allows for user creation when needed and disables login / out of the wiki by normal means

CHANGE THIS FOR YOUR SITE $wgPhpbbSSO_Forum_Location - This needs to be the location of your forum root folder from your wiki.

The default for $wgPhpbbSSO_Forum_Location (./../forum/) works if your site is setup like so
 * example.com/forum
 * example.com/wiki

New Files
Create a folder in your MediaWiki extensions folder called phpbSSO and save the following two files in there as phpbSSO.php and phpbb.php.

&lt;wiki directory&gt;/extensions/phpbSSO/phpbSSO.php
Note: Using this extension sets $wgMinimalPasswordLength to 1.

Using it in your MediaWiki skin
You probably want to change the login/register / logout links to work with the system.

This is how I did this for my wiki.

Replace the current code with the the following code (or something similar) In the skin php file where the personal links are. - In vector they are located in function renderNavigation under case 'PERSONAL':

This also adds a line so a user can see if they have any forum messages from the wiki. I changed the words "user preferences" to "wiki preferences" so it is not confusing to users.

Make sure to set the $forumURL to your forum address.

In Mediawiki 1.18> It is necessary to replace on

How It Works
So... This little guy, what he does is: When a user comes to the wiki, it checks to see if the user is currently logged into the forum. If not, nothing happens. If so, he then looks to see if the user is logged into the wiki. If the user is, then everything is good. If the user is not, he takes the session data from phpbb and logs the user in automatically to the wiki. If there is no such user on the wiki, he creates the user.

Cookies
If the user has cookies turned off, they will probably find themselves in an endless redirection loop.

Backups
If your backups don't work, try setting the REMOTE_USER environment variable manually: