Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles

Reply
 
Thread Tools
Integrate or bridge with MediaWiki
HolisticEarth
Join Date: Apr 2006
Posts: 14

 

Winnipeg, MB, CAN
Show Printable Version Email this Page Subscription
HolisticEarth HolisticEarth is offline 04-13-2006, 10:00 PM

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

How to:
  1. Install Reynaldovb's Restrict usernames to alphanumeric and underscore plugin, and disallow both spaces and underscores
  2. 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.
  3. Open your wiki/LocalSettings.php file
  4. 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.
  5. Insert this code below the require_once( "includes/DefaultSettings.php" ); at the top of the LocalSettings.php file:
    PHP Code:
    # Disabling new user registrations
    $wgWhitelistAccount = array ( "sysop" => 1"developer" => );
    # Disabling anonymous edits
    $wgGroupPermissions['*']['createaccount'] = false;
    $wgGroupPermissions['*']['read'] = false;
    $wgGroupPermissions['*']['edit'] = false;
    $wgWhitelistRead = array ("Special:Userlogin"); 
    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.
  6. 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.
Attached Files
File Type: php AuthPlugin_vBulletin.php (7.4 KB, 490 views)
Reply With Quote
  #12  
Old 04-18-2006, 11:36 AM
HolisticEarth HolisticEarth is offline
 
Join Date: Apr 2006
Location: Winnipeg, MB, CAN
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery
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.
Reply With Quote
  #13  
Old 04-19-2006, 11:26 PM
Brent H's Avatar
Brent H Brent H is offline
 
Join Date: Sep 2004
Location: Phoenix, AZ
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for this, installed and working.
Reply With Quote
  #14  
Old 04-24-2006, 09:42 PM
TheFinney TheFinney is offline
 
Join Date: Dec 2005
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #15  
Old 04-26-2006, 09:23 PM
Cyburbia's Avatar
Cyburbia Cyburbia is offline
 
Join Date: Feb 2002
Location: Ithaca, New York USA
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for making this!

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.
Reply With Quote
  #16  
Old 04-27-2006, 11:45 AM
HolisticEarth HolisticEarth is offline
 
Join Date: Apr 2006
Location: Winnipeg, MB, CAN
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Cyburbia
Thanks for making this!

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".
Reply With Quote
  #17  
Old 05-06-2006, 01:25 PM
ndahiya ndahiya is offline
 
Join Date: Aug 2004
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

# 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.
Reply With Quote
  #18  
Old 05-21-2006, 10:33 PM
BizzehDee's Avatar
BizzehDee BizzehDee is offline
 
Join Date: Apr 2006
Location: Wigan
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #19  
Old 05-23-2006, 02:29 AM
Da Drgon Da Drgon is offline
 
Join Date: Apr 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #20  
Old 05-30-2006, 05:40 PM
thisgeek thisgeek is offline
 
Join Date: Dec 2005
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Da Drgon
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.

So..... It's working
Reply With Quote
  #21  
Old 06-05-2006, 08:16 AM
Da Drgon Da Drgon is offline
 
Join Date: Apr 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:54 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04674 seconds
  • Memory Usage 2,342KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete