I did some testing with this and the code found here ( http://www.mediawiki.org/wiki/Extens...rs_Integration ) seems to work fine with the current version of MediaWiki. My problem is controlling access with UserGroups via vBulletin. Does anyone know how to do that or could possibly point me in the right direction?
In the mean time a couple of years later, but I wanted this bridge between mediawiki and vbulletin too, and got it working, albeit with a few tweaks.
I added a custom usergroup 'wiki' to vB. Members of this group (and admins and mods) are granted to log in to the wiki.
I used the code from the quoted extention above, but ran into 2 things:
Group selection was to 'tight' for me. I wanted to control the wiki access with an additional custom usergroup (so not the primary group)
I wanted to allow spaces, dashes and dots in usernames, since both Mediawiki as vB allow that currently
@group selection
In the functions userExists (and authenticate subsequently) I changed the query from
PHP Code:
$vb_find_user_query = "SELECT usergroupid FROM " . $this->vb_prefix . "user WHERE LOWER(username)=LOWER('" . $username . "')";
to
PHP Code:
$vb_find_user_query = "SELECT CONCAT_WS(',',usergroupid,membergroupids) as groups FROM " . $this->vb_prefix . "user WHERE LOWER(username)=LOWER('" . $username . "')";
With this, you can query both usergroup & membersgroups together.
Since you can have multiple id's in this 'group', the code to match it to the $this->allowed_usergroups needed a little tweaking.
I changed the bottom part of the same 2 functions from
PHP Code:
if (in_array($vb_userinfo['usergroupid'], $this->allowed_usergroups)) {
return TRUE;
}
to
PHP Code:
if (count(array_intersect($this->allowed_usergroups, explode(",",$vb_userinfo['groups']))) >= 1) {
return TRUE;
}
This way it doesn't matter if a member had one or more matching groups with the allowed_usergroups.
@allowed characters
Unfortunately I didn't succeed in modifying the search pattern to only accept alphanumeric or underscore characters in usernames. I did a dirty workaround to bypass the whole check.
I replaced
PHP Code:
(!preg_match($this->searchpattern, $username))
with
PHP Code:
(count_chars($username) > 0 )
in both functions.
If someone has a better solution I'd like to hear it. I'm not that kind of a guru at PHP