MediaWiki Bridge Freedback -


I'm going to try to bust this out tonight or tomorrow. I'm really feeling the coding frenzy so we'll see how much I can get done.

Immediate To Do List
Required before I can push it to the live site.
  • ✓ Wiki BbCode that inline links articles from posts.
  • ✓ Database connection settings in the ACP.
  • ✓ Table mods on XenForo to store MediaWiki User ID on users.
  • ✘ XenForo Wiki Portal that lets you create a Wiki user with a button press.
  • ✘ Additional form to bind an account that already exists.
  • ✘ Admin control to add, edit, and delete binds at will.
  • ✘ User profile link to their Wiki account.
Luxury Items
Things I want to add, eventually.
  • XenForo Wiki Portal will show recent edits and active articles.
  • Sidebar for recent edits.
  • User profile tab with wiki edit history and favorite articles.
  • Allow forum threads to bind to a wiki article so one links to the other.

These are some early screenshots.



Making steady progress. I'm working back to front, so I want to get the ACP working 100%. It's easier to write business logic for the ACP because you're not concerned about a lot of security issues. One of the big problems ahead is having the MediaWiki password verification and, even more so, allowing people to log in to the XenForo account through MediaWiki and creating an authentication cookie. It's going to be tricky but I'm not deterred.



In the above screenshots only the templating and routing was done.
I've completed the ACP add/remove business logic.

This is the first transaction involving the cross-database work. XenForo has its own database, MediaWiki is on a different database. Theoretically, they can be across the world from each other, but XenForo can talk to it through this code (it'd just be really slow).

The next button is the Create New Account button. This is more difficult because it involves editing the MW database, not just reading from it. This is also more difficult because I have to emulate a lot of the MediaWiki functionality perfectly to get the bridge to work.


I've gotten stumped with MediaWiki. MediaWiki is such complete fucking shit it is impressive. The biggest flaw I'm encountering is an inability to allow users to keep their names, let me explain.

On XenForo, you can use almost any character in your name. This is because your name is a text string representing your user id in the database.
We can have two users named "Barack Obama" and "Barack_Obama", or "#Barack_Obama", because that's just a name.
In the URL bar, all three of those names would have different user ids. For instance, my URL is /members/null.1/. If you access /members/1/, it works. If you access /members/really-cool-guy-and-great-friend-dont-abandon-him.1/, it also takes you to my page. The significant part of that URL is the number 1, not the text.
The three Obamas would be /members/barack-obama.xxxx/, with a different number depending on which account.

MediaWiki doesn't fucking do that and cannot be forced to do that. MediaWiki handles usernames the same way they handle articles.
If you've ever had experience with a Wiki, you'll know that underscores are turned into spaces in the article title and spaces are forced into underscores in the URL. "Barack Obama" becomes /wiki/Barack_Obama. Hashtags, pipelines|, slashes/, ? and &, etc are all illegal characters in URL routes so #Barack_Obama can't exist at all.

My primary concern with this bridge was letting users log in with their Kiwi Farms account, and everything else is secondary. So I thought a cool solution would be to make it so that the Username is technically your XenForo user id (in my case, 1, so my page would be /wiki/User:1), but I would hack it so that any time your username was rendered on a page (article names, recent changes, user lists, etc) it would instead show your real XenForo username, including illegal URL characters.
Then I discovered that MediaWiki is designed like shit and there's literally no way to do that without changing the MediaWiki code outside of my extension. If I were to do that, my mod would be incompatible with any other version of MediaWiki and upgrading and selling the mod to other XenForo/Wiki site owners would be impossible.

So now I'm back to square one with how I'm going to do the account sharing. I'm probably just going to have to complicate matters by forcing users to pick a MediaWiki-compliant username if their name is invalid or taken. This bothers me greatly because I tried so hard to get this shit to work but it's the obvious path of least resistance.


I've decided everyone's username will become their XenForo URL. E.g., mine would be null.1. This works perfectly with MediaWiki's system and allows me to rely on an existing convention. Using with existing accounts will be able to bridge those manually.

On that note, the create account button on the ACP works.


And this is a full look at what the ACP looks like when bridging users.

"root", funnily enough, is an invalid username for MediaWiki because it also forces you to have a capital letter for the first letter in your name. I have no fucking clue how MediaWiki's username conventions became so laughably obtuse, but I've barreled through it at this point. Names can appropriately support Japanese, Chinese, Arabic, and other accented characters as MediaWiki does, and combined with the XenForo link formatting, I can ensure unique names for everyone.

This unfortunately means your name will be a bit ugly ("Null.1" instead of "Null", "About-blank.7293" instead of "about:blank", etc). However, it's a lot less shit than just "7293" like I previously planned, and I can still follow through with the Real Names stuff later on with less urgency.

The next step is to make sure you can log into your XenForo account through the MediaWiki login form. With this process, you should be able to register an account just by signing in.
Last edited:


Huge progress.

New XenForo user: "test"

Signing in with test on the wiki

Wiki account automatically generated, User:Test.2 as the name.

Bridge reflects new account on profile.
  • Optimistic
Reactions: CatParty


Conflict Resolution Officer
Doesn't work for me, I think it is because I have a '_' in my name.
EDIT: I got this error "You have not specified a valid username."


I think people have noticed already that you have to log in twice the first time.
As I've detailed, MW is a piece of shit. It seems impossible to create a user and log into it in a single pass.

However, I am going to disambiguate this error message. New users will see this message once:
<The wiki had to create an account for you. Log in again.>

You should only see this once.

Doesn't work for me, I think it is because I have a '_' in my name.
EDIT: I got this error "You have not specified a valid username."
Looking into this now.


I posted this in the subtitles thread, but the next step from here is adding Article Names to threads. From there, I'll be able to do fun things, like add banners to the top of each page and insert the article over the OP on the first page.


Luminous Being

True & Honest Fan
Good stuff. :semperfidelis:

Bit of an issue to maybe think about that just came to me is that, with you (@Null ) out of the equation when it comes to creating new accounts, there's a good chance that people are going to register that just want to fuck with the wiki or get rid of information on the live site.

You should give a few people block and reverse rights and shit (@Jaimas for example, he lurves the wiki a lot) and make it so that banned accounts on the forum get blocked on the wiki as well.


You should give a few people block and reverse rights and shit (@Jaimas for example, he lurves the wiki a lot) and make it so that banned accounts on the forum get blocked on the wiki as well.
Jaimas and Darwin are already sysops. I should probably dignify them in some way on the forum, but yeah. The reason I started the bridge was to control bans more easily, and adding that feature is trivial.

Darwin Watterson

Custom titles are for nerds
True & Honest Fan
How do you add the Wiki banner to existing threads? I may just be an exceptional individual, but I wasn't seeing an option when I went to edit a thread I made whose subject now has a page.