vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Integrate or bridge with MediaWiki (https://vborg.vbsupport.ru/showthread.php?t=112973)

HolisticEarth 04-13-2006 10:00 PM

Integrate or bridge with MediaWiki
 
1 Attachment(s)
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.

pipin 04-14-2006 07:00 AM

Thanx HolisticEarth,

maybe you should add $wgCapitalLinks = false; too, so the usernames will be exactly the same and not changed at the first letter.

machtzu 04-14-2006 10:21 PM

Probably one of the best little snippets of code here! Well done HolisticEarth, its awesome! :banana:

Jon_Simmonds 04-16-2006 12:22 PM

Ive been using the original method for a while, ill take a look at the code and see if I can merge it in to mine(done so many edits since then, which ive not made notes on..)

Also if you like to use subdomains on yoru sites, ill find the code so you can have something like http://wiki.site.com/PAGETITLE (eg http://wiki.exceem.co.uk/Help:Contents)

HolisticEarth 04-16-2006 02:18 PM

Quote:

Originally Posted by Jon_Simmonds
Ive been using the original method for a while, ill take a look at the code and see if I can merge it in to mine(done so many edits since then, which ive not made notes on..)

Also if you like to use subdomains on yoru sites, ill find the code so you can have something like http://wiki.site.com/PAGETITLE (eg http://wiki.exceem.co.uk/Help:Contents)

The article on making a really short url for MediaWiki is here:
http://meta.wikimedia.org/wiki/Using_a_very_short_URL

However I am not a hardcore techie to konw which (if any) of the methods listed are foolproof. I have heard now and again that some of those methods do not work perfectly, as in they will not display URLs that contain periods properly.

Also, the script I came up should work great with the other script... the only difference is the extra function call in your LocalSettings.php file for your vB table prefix. If you simply add that information to the LocalSettings.php, then all you need to do is replace the original file with my file and you will be good to go, no worse than before, but have more functionality.

rockaffe 04-17-2006 07:30 AM

I've followed the instructions but it don't work...
When i open my wiki page it remain to an error page.

http://tutorialweb.org/wiki/

here is the link.

Bye!

HolisticEarth 04-17-2006 12:45 PM

Quote:

Originally Posted by rockaffe
I've followed the instructions but it don't work...
When i open my wiki page it remain to an error page.

http://tutorialweb.org/wiki/

Did you try logging in using your vb information?

You might want to try changing
PHP Code:

$wgGroupPermissions['*']['read'] = false

to
PHP Code:

$wgGroupPermissions['*']['read'] = true

if you want anonymous users to be able to read the wiki.

rockaffe 04-17-2006 02:13 PM

I'll be happy if I can use my info to login but in the wiki page no login box appear, and if I click on "login" it remain on the same page.

However when I visit that page, I'm already logged in on my vbulletin.

HolisticEarth 04-18-2006 01:09 AM

Quote:

Originally Posted by rockaffe
I'll be happy if I can use my info to login but in the wiki page no login box appear, and if I click on "login" it remain on the same page.

However when I visit that page, I'm already logged in on my vbulletin.

I can't provide technical support for it. You dont have to login to the forums, you just have to have an account there. Then you have to login with that same information on the wiki, and your login information must have only alpha-numeric characters.

Zachery 04-18-2006 01:18 AM

Intresting, say I already have a wiki setup and working, how will this work then?

HolisticEarth 04-18-2006 11:36 AM

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.

Brent H 04-19-2006 11:26 PM

Thanks for this, installed and working.

TheFinney 04-24-2006 09:42 PM

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!

Cyburbia 04-26-2006 09:23 PM

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.

HolisticEarth 04-27-2006 11:45 AM

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".

ndahiya 05-06-2006 01:25 PM

# 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.

BizzehDee 05-21-2006 10:33 PM

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?

Da Drgon 05-23-2006 02:29 AM

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?

thisgeek 05-30-2006 05:40 PM

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 :)

Da Drgon 06-05-2006 08:16 AM

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!

sub_ubi 06-06-2006 06:10 PM

HolisticEarth,

To overcome the username issue, did you look in to the possibility of

Quote:

Making any links to a user's page link to their user page on vBulletin. Theoretically, this would allow people to keep their usernames intact, while not interfering with the MediaWiki namespace.
from

http://meta.wikimedia.org/wiki/VBull...rs_Integration

If so, what did you think about it?

Cyburbia 06-11-2006 03:25 AM

I'm going to bump and ask the same thing.

HolisticEarth 06-13-2006 01:33 AM

Here I thought summer would come and I would have time to fiddle with things :/.

I have not tried it atm ... has anyone else tried merging the two more fully to use the vB sessions instead?

yessir 06-25-2006 02:30 PM

I'm not much of a coder but I can certainly test over the summer.

My forum is located in the web root, and I want to also toss my wiki into the web root. Does anyone see a problem with this?

Ideally the wiki is the landing page at www.mydomain. com. Or would I be better off dropping the wiki into a /wiki directory, or moving the forums (urgh) to /forum?

Also, has anyone tried this with vBSEO installed? Any potential .htaccess hacks required?

Thanks in advance.

offline 06-28-2006 12:45 AM

I installed this but none of my users can login. Is there a log file or something telling me why this might not be working?

Thanks!

thumbsucker 06-30-2006 12:50 PM

This is off topic but I tried to install Wiki and got this error.

Anyone know what's wrong?

include all of the lines below when reporting installation problems.

PHP 4.3.11 installed
PHP server API is apache2handler; ok, using pretty URLs (index.php/Page_Title)
Have XML / Latin1-UTF-8 conversion support.
PHP's memory_limit is 32M. If this is too low, installation may fail!
Have zlib support; enabling output compression.
Neither Turck MMCache nor eAccelerator are installed, can't use object caching functions
GNU diff3 not found.
Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads.
Installation directory: /var/www/vhosts/mysite/httpdocs/mediawiki
Script URI path: /mediawiki
Environment checked. You can install MediaWiki.
Warning: $wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.
Generating configuration file...

Database type: mysql
Parse error: parse error, unexpected $, expecting '}' in /var/www/vhosts/mysite/httpdocs/mediawiki/includes/Database.php on line 459

mickmel 07-02-2006 11:15 AM

Will this work with vB 3.6.x and MW 1.6.7?

Deimos 07-05-2006 10:43 AM

I'm getting the same problem

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/wiki/AuthPlugin_vBulletin.php on line 90

I've double checked the login details for the database, all are ok

thumbsucker 07-05-2006 11:38 PM

Is support for this alive?

I filled in my DB info in the mediawiki config file but no one from vbulletincan login.

HolisticEarth 07-06-2006 04:44 AM

I don't want to sound negative, but I dont have the time to support this ... it was a How-To because I dont have the time to make it a perfect add-on / hack / etc., and the old How-To was non-existant.

For vB 3.5.4 and MW 1.6.7, and my original installation method, my installation still works logging in and logging out. I'll try putting it in user.php instead of LocalSettings.php tomorrow and let you know how it works out...

jeffj 07-07-2006 02:57 PM

has anyone tried to get mediawiki running inside of menu driven framework?

I had a masthead and menu bar (javascript) and a left nav bar with serves up banner ads and I want to maintain this look and feel to my site and add a wiki, but I am pulling my hair out trying to get this code into monobook.php

have anyone done this?

yessir 07-27-2006 12:10 PM

Thanks Holisitic Earth. You've given us a starting point!

Anyone care to comment on Mediawiki and vBull in the same directory?

Renmiri 08-05-2006 11:04 PM

Wow, you are an angel!!!

I had the user databases integrated with phpBB and now that I moved to vB the Wiki does not allow any new user :(

Thanks, this will help a lot!!!

:)

ElfMage 08-07-2006 06:07 AM

Hello everybody, I too have been looking for a way to integrate MediaWiki with vBulletin.

However, in my case, I decided to write my own plugin, as I had certain requirements that were not met by existing solutions.

Anyways, if you would like to give my extension a try go here: http://www.luxurywiki.com/wiki/Luxury_vBulletin

ElfMage.

yessir 08-07-2006 10:56 AM

ElfMage, when your plugin has a little more development behind it, I will test for sure. It looks very, very promising. Thanks!

lightwave 08-08-2006 04:52 AM

What happens if a user has username that is not alphanumeric or underscore.

Does it produce an error? Or they simply just can't log in but the others with correct username can?

ElfMage 08-08-2006 05:04 AM

Quote:

Originally Posted by lightwave
What happens if a user has username that is not alphanumeric or underscore.

Does it produce an error? Or they simply just can't log in but the others with correct username can?

That's one of the current limitations. I haven't tested the scenario you describe, but it should behave as you describe.

Users with special characters will be able to login into vB, but not MediaWiki. Regular users will be logged in/out from both.

However, I think that this is fairly easy to correct. Let me give it some more thought.

Quote:

ElfMage, when your plugin has a little more development behind it, I will test for sure. It looks very, very promising. Thanks!
Thanks yessir. I am developing this extension for my site, but I thought I'd share it with the community..

ElfMage.

thenetbox 08-13-2006 04:40 PM

Hi,

Does any one know if this is working with VB 3.6? Thank you

yessir 08-13-2006 04:48 PM

LuxuryWiki is being developed for 3.6

thenetbox 08-13-2006 05:15 PM

oh cool :) thank you


All times are GMT. The time now is 10:18 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.02146 seconds
  • Memory Usage 1,858KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete