SMF and MediaWiki Bridge

Started by rsw686, February 08, 2008, 08:28:51 PM

Previous topic - Next topic

rsw686

After testing out both bridges currently available for SMF and MediaWiki I decided to write my own. Let me first go through what I liked and didn't like about the existing bridges.

First Bridge:
http://www.mediawiki.org/wiki/Extension:SMF_Authentication
http://www.simplemachines.org/community/index.php?topic=195978.0

This bridge allows for auto authentication by using the smf_api.php. Due to the number of files required I did not test this bridge. I didn't want to deal with the hassle when upgrading software down the road. Especially because SMF 2.0 database tables are different and I wasn't sure if the smf_api.php would be updated.

From looking at the code if a user is demoted from the administrator position it does not remove him from the wiki sysop group. It also looks to create two instances of an account with the auto authentication due to wiki requiring upper case for the first letter and it doesn't format the name with ucfirst. Please note that I could be wrong, but these were issues I ran into when using similar code.

One feature it is lacking is the ability to declare an SMF group that is only allowed to edit the wiki.

Second Bridge:
http://www.mediawiki.org/wiki/Extension:SMF/Users_Integration

This bridge does not do anything with auto authentication. It does allow you to specify a SMF group that is allowed to edit the wiki. Another plus is that it is a single file. The downside is the configuration does not use the values from SMF's Settings.php. You have to specify the database tables and permissions. It also doesn't set wiki sysop privileges for SMF administrators.

I did test this one out and found a small issue. For one they did not disable the change password option in the wiki, which doesn't work anyway due to the rest of the code not being there. This only requires a change of true to false, which must have been an oversight.

My Bridge:
The SMF and MediaWiki integration I built only requires one file placed in the wiki extensions directory. To get started you only need to configure the relative path to your SMF forum. In the default configuration the wiki login is separate from the forum. It will assign and remove sysop privileges to SMF administrators and allow you to lock down editing to an SMF group.

For the auto authentication I have decided not to use the smf_api.php file for the above reasons. When you click login / logout the wiki redirects you to the SMF page and then back to the wiki. A couple of gotchas are that you must be using SMF database sessions (default setting). You also need to configure SMF to make sure local storage of cookies are disabled. You might not need to do this if your wiki is inside your forum folder.

The bridge also supports SMF usernames with underscores. MediaWiki converts underscores to spaces which causes authentication problems with almost all other bridges. I developed a work around by checking for the first registered SMF username with spaces or underscores. It is very unlikely that two SMF users will have the same name like john_smith and john smith. If they do you'll need to change the username of the later registered SMF user.

You can download the bridge from http://wgnrs.dynalias.com/smf/Auth_SMF.php
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

klra

Does your bridge have an issue (like the others) with members that have a _ or - in their username?

I am seriously thinking of setting this up for my forums & members.

Also, would an bridged installation be viewable to all on the net or just to the forum members?

I'd like to have our Wiki viewable by all, but with permissions set so that only Admins, Mods or possibly forum members would be able to edit the content of the Wiki.

Thanks!

rsw686

Quote from: klra on February 09, 2008, 12:02:09 PM
Does your bridge have an issue (like the others) with members that have a _ or - in their username?

I am seriously thinking of setting this up for my forums & members.

Also, would an bridged installation be viewable to all on the net or just to the forum members?

I'd like to have our Wiki viewable by all, but with permissions set so that only Admins, Mods or possibly forum members would be able to edit the content of the Wiki.

Thanks!

I'll test out the _ and - in the user names and get back to you. The wiki is viewable by all. Administrators can always edit. By default only members can edit. If you don't want members to edit, just create a new SMF group and assign nobody to it. Configure the wiki LocalSettings.php value to that group name. Then you can add members as needed to that group and they will be allowed to edit.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

klra

Ok, I'm gonna look closely at this Wiki & bridge, as it's something that Ive wanted to ad to my website & forums.

Not being very good with code, I'm hoping to see some more installation info about how to impliment the bridge if you are so inclined.

Thanks for writing this!

klra

QuoteIf you don't want members to edit, just create a new SMF group and assign nobody to it. Configure the wiki LocalSettings.php value to that group name. Then you can add members as needed to that group and they will be allowed to edit.

So the permissions can be set up to only allow specific membergroups to edit the Wiki- this is great because then I can allow only veteran/trusted members access.

This will prevent new members and malcontents from posting irrelevant data.

rsw686

Usernames with - work correctly using the wiki login separate or with the auto authentication. If you have a _ in your username it only works with the auto authentication. The wiki software converts _ to a space. I could convert it back to a _, but then there could be a conflict with a username with a space. I'll look into it.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

klra

Thanks- I wasn't sure if this would be an issue with the members that have one of those characters in their username or not.

I don't think it would be an issue though, as I think I will be only allowing editing access to Admins, Mods and specific high post count members - and if they have have one of those charachters in their username, I could encourage them to change their name if they want access.

rsw686

Quote from: klra on February 09, 2008, 01:39:06 PM
Thanks- I wasn't sure if this would be an issue with the members that have one of those characters in their username or not.

I don't think it would be an issue though, as I think I will be only allowing editing access to Admins, Mods and specific high post count members - and if they have have one of those charachters in their username, I could encourage them to change their name if they want access.

Yeah for now I'm just going to say user names with _ in them won't work using the wiki login. They do work fine if you use the auto authentication.

To get started install the mediawiki software. If you are going to use the same database make sure to set the prefix during the installation. This makes it easy to determine what tables go with what. I used the mw_ like recommend.

Afterwards just copy the SMF_Auth.php file to your wiki/extensions directory. Add the lines from the top of SMF_Auth.php to the end of the wiki/LocalSettings.php file. Start with just configuring the $wgSMFPath path. Once you get this right you should be able to login with your forum name via the wiki login.

Then you can enable the other settings to configure the auto authentication part.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

klra

Will there be a Wiki tab in the forums or will I have to create one?

And if I do have this Tab/link, will going to the Wiki from the forums do the auto login ?

I think that would be best. Then setup the Wiki to have no front end login on the wiki page itself. This would then allow editing access through the forums only by those logged in, authorized members.

Also, expect some more questions about implimentation/installation of this bridge, as I (annd maybe some other folks here) may have questions about it. I know I do already-

klra

QuoteIf you are going to use the same database make sure to set the prefix during the installation. This makes it easy to determine what tables go with what. I used the mw_ like recommend.

That went right over my head.

Sorry, but it looks like I'll need a bit more guidance -

rsw686

Quote from: klra on February 09, 2008, 02:05:14 PM
Will there be a Wiki tab in the forums or will I have to create one?

Nope you have to add the tab yourself. The integration only deals logins. I modified a wiki theme to make it match my site.

When you set the auto authentication ($wgSMFLogin = true;) the login / logout links of the wiki will redirect you to the forum login page and use the forum logout function. Navigation to the wiki when logged into the forum will auto log you into the wiki.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

rsw686

Quote from: klra on February 09, 2008, 02:07:26 PM
QuoteIf you are going to use the same database make sure to set the prefix during the installation. This makes it easy to determine what tables go with what. I used the mw_ like recommend.

That went right over my head.

Sorry, but it looks like I'll need a bit more guidance -

After you upload the mediawiki files and navigate to it with your browser it will walk you through the installation. You need to decide if you are going to create a new mysql database for the wiki or use the exisiting mysql smf database. It doesn't really matter, its more about how you want it organized. Both work the same. I just used the SMF database.

If you use the SMF database you would fill in the database name and login username and password. Towards the bottom it asks if you want a table prefix. Fill in mw_. This way it will name the tables mw_users, etc vs just users. The SMF tables are smf_members, etc. This keeps it organized.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

klra

QuoteNope you have to add the tab yourself. The integration only deals logins. I modified a wiki theme to make it match my site.

No sweat there, pretty easy to do.

QuoteWhen you set the auto authentication ($wgSMFLogin = true;) the login / logout links of the wiki will redirect you to the forum login page and use the forum logout function. Navigation to the wiki when logged into the forum will auto log you into the wiki.

Good to hear.


klra

QuoteAfter you upload the mediawiki files and navigate to it with your browser it will walk you through the installation. You need to decide if you are going to create a new mysql database for the wiki or use the exisiting mysql smf database. It doesn't really matter, its more about how you want it organized. Both work the same. I just used the SMF database.

I'll probably go with a seperate, dedicated database for the Wiki, completely seperate from the SMF database.

QuoteIf you use the SMF database you would fill in the database name and login username and password. Towards the bottom it asks if you want a table prefix. Fill in mw_. This way it will name the tables mw_users, etc vs just users. The SMF tables are smf_members, etc. This keeps it organized.

So what does this mean to me as I will be installing a new database?

klra

sorry, another question-

QuoteI modified a wiki theme to make it match my site.

How did you do that?

There was very little guidance on how to do this at the Wiki site (Configuration).

rsw686

Quote from: klra on February 09, 2008, 02:15:27 PM
QuoteIf you use the SMF database you would fill in the database name and login username and password. Towards the bottom it asks if you want a table prefix. Fill in mw_. This way it will name the tables mw_users, etc vs just users. The SMF tables are smf_members, etc. This keeps it organized.

So what does this mean to me as I will be installing a new database?

Don't worry about it then.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

rsw686

Quote from: klra on February 09, 2008, 02:16:51 PM
How did you do that?

There was very little guidance on how to do this at the Wiki site (Configuration).

I just took the html code for my header and added it above the wiki template code. Then I changed the css values for the colors. The link to my site is in my signature.

Have a look here for the wiki skins. Mine is a modified version of KindofBlue.

http://meta.wikimedia.org/wiki/Gallery_of_user_styles
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

klra

#17
That look great!

So you are using a custom SMF theme, and the bridge makes the wiki in the same format?

Or is your site a Tiny Portal setup in SMF?

Not sure how you did it, as the wiki seems to seamlessly integrated into your site/forums-

klra

The reason I ask about your setup is because of the integration.

My site is Joomla based, and not bridged to the forums (SMF1.1.4).

rsw686

Quote from: klra on February 09, 2008, 02:31:28 PM
That look great!

So you are using a custom SMF theme, and the bridge makes the wiki in the same format?

Or is your site a Tiny Portal setup in SMF?

Not sure how you did it, as the wiki seems to seamlessly integrated into your site/forums-

The bridge does nothing with the wiki layout. All it does is link the username / password logins.

My site uses SMF, the SMF SSI.php functions for the front page, Coppermine for the gallery (it has a built in bridge to integrate with SMF), and MedaWiki with the integration I made.

The theme for SMF is one I created. It involves a div wrapper for the entire page and a table for the header and menu. I took this header and modified the Coppermine theme the same way. I then did the same thing for the KindofBlue mediawiki skin.

Thus when you go to them they all look the same. I'm not sure how else to explain how I made the theme. It isn't the easiest thing to do and really just takes some time to get everything lined up exactly right.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Advertisement: