Extension:VBulletin/Users Integration



Working Example
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
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 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.
 * Install Reynaldovb's Restrict usernames to alphanumeric and underscore plugin, and disallow both spaces and underscores (vbulletin 3.7+ use the admincp / Options / Username Regular Expression field to ensure the username conforms to a certain format).
 * 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 ?>:
 * Insert this code below the require_once( "includes/DefaultSettings.php" ); at the top of the LocalSettings.php file:
 * Copy this AuthPlugin_vBulletin.php file and put it in your main wiki directory, ie: /wiki/AuthPlugin_vBulletin.php

Anonymous / Guest Visitors
In vB, a nice feature is to track the non-registered visitors. You can see how many members AND GUESTS on presently at the site... even down to the thread level.

It occurs to me that whenever someone goes to MW, it triggers a vB session and/or logs them in if there is a cookie. The reason is that some, actually more and more, people are going directly to the MW. I would like to make sure that the site stats as to who has been to the domain are maintained site-wide.

Login

 * If attempt is made to perform a function that requires login, redirect to vB to login.
 * Afterward, return user to page from where he came from.
 * Files to modify

Welcome to your next beauty destination! Founded in 2014 by a female entrepreneur in Dubai with a strong vision that every person is unique and needs his beauty treat to fulfill his ultimate potential, an Art of Beauty Center has become a preferred style destination for both expats and residents in Dubai. An „Art of Beauty“ brand as first one in the UAE, that despite of the difference in cultural and linguistic barriers, as well as social norms of a new country, is offering an ultimate approach for a beauty care as an essential part of individual health care. It`s one of the selected salons, that offers a wide range of face, hair, and body treatments for all- ladies, gentlemen, and children. With a code of ethics, Art of Beauty eventually appeared to be to be a choice for personal care and beauty advice for many people with different background, age, nationality and workplace and interests. Over the first six months, the beauty center has shown its commitment to high professional standards and a delicate approach to individuality for everyone, who came here for an exceptional and delightful experience. Today, The Art of Beauty Center is a diverse range of professional`secrets and self-determination of every member of the team to perfection to create your phenomenal visual look and number one feeling.

Passwords

 * Only use vB

Authentication Method
Here is some base code for authenticating. This is not a working example, it is only a starting point.

This code needs to be modified to accommodate MediaWiki's needs by setting cookies. The query also may need to be enhanced to to look for things MediaWiki uses in its cookies/sessions. Thanks to Alfarin over at vb.com for this start.

Preferences

 * Default switches ON for:
 * Send me an email on page changes
 * Send me an email when my user talk page is changed
 * Need to disable certain options (preferences) that are now handled by vB
 * User dialog: Real name, email, nickname, raw signature, language
 * Password dialog: disable all, Use vB instead
 * Email dialog: Disable e-mail from other users (Use vB switch for that)
 * Skin dialog: Disable all (default to MonoBook)
 * Time zone dialog: Disable, use vB

Email User

 * Link in MW toolbox: Special:Emailuser/ to link to vB's function (vB/sendmessage.php?do=mailmember&u=#####) for this.
 * OR since email addresses are synchronized with MW, make no change.

Email Notifications

 * Use the email from MW since email addresses are synchronized.

Links back to vB

 * MW User: page to provide (in header, right-justified) a link automatically to vB user profile and link to email or PM.
 * In localsettings.php, provide for user defined icon path to define vB user profile link AND one for link to vB/MW email function
 * In preferences, user data dialog: Add link to vB user control panel (profile)

MW Special Pages

 * Special:Listusers: We need to add a link/icon next to each listed user to their vB profile.

Useful Extension Proposals

 * username=johndoe;fld=userTblFieldName Return vB user table field value
 * username=johndoe Return site defined icon that links to vB email user feature.

Skin/Style Issues

 * Question: Make MW the entry point with link to vB OR make vB the entry point to site?
 * If MW is the entry point..
 * Need to add key userCP type menu options
 * Need (IMHO) to present key vB type info on front page such as Who's Online!!!! Since MW caches pages, where/how to inject some real-time info into page? Turn off caching? Insert 'live' content AFTER footer? :(

vB Functions That Affect MW

 * User updates password
 * User changes email
 * User toggles switch to accept emails from others
 * User changes timezoneoffset
 * User changes real name fields
 * User changes homepage, or other fields

Sessions

 * Need to keep vB sessions alive so that we can see who's online whether they are in MW or in vB

Integration Issues
The largest problem with integrating vBulletin and MediaWiki is the use of characters not allowed in the MediaWiki namespace. In MediaWiki, the characters allowed in a username are the same that are allowed in a page name, and you can find those on the Help:Page name page.

There are two easy possibilities, which I have not explored or found information on:
 * If you have a small vB membership, renaming people's usernames so that they do not have the unwanted characters. In this case you will also want to edit vBulletin's registration function to disallow unwanted characters as well.
 * 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.