Do you want to use vBulletin's user database with your MediaWiki? You might like this.
I have taken Kai Backman's MediaWiki authentication plugin idea, fixed coding errors, and expanded greatly on it.
Working on:
vBulletin 3.5.4 and MediaWiki 1.6.3
Features:
Allows you to run MediaWiki with your vBulletin user database
Disallows users with invalid username characters
Disallows users who are not part of specified usergroups
Sets users to sysop status in MediaWiki if they are part of a specified admin usergroup
Removes users from sysop status in MediaWiki if they no longer are a part of a specified admin usergroup
For same-database setups, allows easy installation
Possible Future Features: These are possible features for inclusion in the how-to in the future. They have not been investigated for their feasibility, but are here to let you know they have been requested and I am thinking about them. If you know how to add the features, please let us know.
No-login required (automatic) integration
Option: User profile field points to, or has option to link to vBulletin profile
To register, link the user to vBulletin's registration script on the login pages
Optional: On boards that already have existing users, somehow have their usernames changed so that they are only alphanumeric. This is required if you wish your users to be able to login and edit the wiki using their vBulletin username. The reason you have to do this is because MediaWiki has some Restrictions on what can go in a page title, and as usernames have to be passed as page titles, they also have to adhere to the same restrictions. If you do not change the usernames, I have included a check to not allow users to login if their username contains non-alphanumeric characters.
Open your wiki/LocalSettings.php file
Insert the following code at the end of the file, before the ?>:
PHP Code:
# vBulletin integration script
require_once("AuthPlugin_vBulletin.php");
// if vBulletin and MediaWiki are not installed on the same database
// change these values to reflect your vBulletin database information
$wgAuth = new AuthPlugin_vBulletin($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, "vb_");
If you are running vBulletin and MediaWiki in the same database, then it already uses the connection information.
If you are not running vBulletin and MediaWiki in the same database, please change the strings to reflect your vBulletin database information.
In either case, the last value is whatever your vBulletin table prefix is.
Insert this code below the require_once( "includes/DefaultSettings.php" ); at the top of the LocalSettings.php file:
This prevents people from registering new accounts on the wiki, requiring people to register on vBulletin. It also prevents anonymous edits. This code may only work on MediaWiki 1.5.x and above, but I am unsure.
Download the AuthPlugin_vBulletin.php file and put it in your main wiki directory, ie: /wiki/AuthPlugin_vBulletin.php
Please let me know if this was helpful, or if you can expand on this code.
Intresting, say I already have a wiki setup and working, how will this work then?
It wont erase anything from the database. It is like other plugins - you just install it and it starts using the vb database for login info. There might be conflicts if users have the same info but different passwords, or if another user has a different username that exists for someone else, but I dont know ... i started this from a fresh wiki. A sure way to fix it would be to erase all the users but wikisysop and start with a fresh users db.
I'd use it if it weren't for the "no alphanumeric characters" restriction. It would be terrific id there was a way around it.
Yeah, I have a forum with a moderate amount of people (~3000), and there are many non-alphanumeric characters as well.
I like your website btw, I found a bit of information on it for a paper or two I have done at University.
Quote:
Originally Posted by TheFinney
Hi, I'm not that great at PHP. For the changing of the values, do I replace everything after the $, or after the $wgDBserver, or something else?
Thanks!
For the values, and php in general, $something is a variable, and if it is a string, you can thing of it as "somevalue". So if you were to hard-code something like the server name, you would replace $servername with "servername".
# Rehash of sammyman's and my posts in the old thread::
You might get the following error (looks like only with PHP 4.3.11):
Quote:
Fatal error: Call to a member function on a non-object in /home/user/public_html/manuals/includes/SpecialUserlogin.php on line 314
Workaround: In includes/SpecialUserlogin.php, find:
$u =& $this->initUser( $u );
Replace this to this:
$u = $this->initUser( $u );
Excessive Database Pings
Quote:
Originally Posted by HolisticEarth
[*]Open your wiki/LocalSettings.php file[*]Insert the following code at the end of the file, before the ?>:
PHP Code:
# vBulletin integration script
require_once("AuthPlugin_vBulletin.php");
// if vBulletin and MediaWiki are not installed on the same database
// change these values to reflect your vBulletin database information
$wgAuth = new AuthPlugin_vBulletin($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, "vb_");
If you are running vBulletin and MediaWiki in the same database, then it already uses the connection information.
If you are not running vBulletin and MediaWiki in the same database, please change the strings to reflect your vBulletin database information.
In either case, the last value is whatever your vBulletin table prefix is.
This works perfectly fine, but for one problem.... Inserting the code in LocalSettings.php creates a "session" to mysql every time someone accesses *any* page in the wiki... (you can see this by putting in the wrong password). On my server, this caused too many sessions being created in mysql, and resulted in the intermittent access problems (as the db was unavailable)!!
The way around this is (Thogh a less elegant solution, and one you have to reapply every time your upgrade mediawiki) to insert the same code near the begining of "includes/User.php"
This takes care of the excess pinging problem, as the vb database is accessed only when a user tries to login.
hey,
i used this to try to integrate my mediawiki 1.6.x install with my vb3.5.x install. i did exactly, and only, what the tutorial said... none of the users on the board are able to use their login that they registered with vbulletin, on mediawiki.. is there something im missing?
I'm getting the same problem... running MW 1.6.5 and vb 3.5.4 here.... I followed the instructions but instead of denying anonymous read access, I left it enabled... I also inserted the $wgAuth code in includes/user.php instead of localsettings.php after reading ndahiya's post
I'm getting this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/wiki/AuthPlugin_vBulletin.php on line 90
FYI, my site is run off a shared host, so all my database name starts with my host login name then an underscore then the actual database name (ie: joeuser_wiki)
does this have something to do with MW not being able to access the vb_ tables? if so how do I specify directly where to find the tables in the code snippet? or is it just more coding errors?
I'm getting the same problem... running MW 1.6.5 and vb 3.5.4 here.... I followed the instructions but instead of denying anonymous read access, I left it enabled... I also inserted the $wgAuth code in includes/user.php instead of localsettings.php after reading ndahiya's post
I'm getting this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/wiki/AuthPlugin_vBulletin.php on line 90
I'm getting the same issue with MW 1.6.6 and vb 3.5.4. I also inserted the code in includes/User.php. It doesn't work even if I do it as originally directed.
I'm running PHP 5 and MySQL 5.
EDIT: I'm a complete tosser. I just realised I had the database connection info completely wrong. *sigh* That's what you get for trying to do stuff like this when you're tired.
thanks for replying and getting me to rethink of what I've exactly done.... so I'm an idiot and I also had the connection info wrong.... it's working now on MW 1.6.6!