For all the people coming here for an SSO solution. I was able to implement SSO from WP to MW using OAuth 2.0 i am using MW 1.30 i have posted my solution at stackoverflow if you find it helpful please up-vote my question and answer there thank you.
Extension talk:WPMW/Flow
MediaWIki 1.2.7 broke this extension. It seems that many changes were made to the Authentication system of MediaWiki. I get the following error message:
Exception encountered, of type "InvalidArgumentException"
I feel like fixing this extension is out of my coding ability, but I will try anyway.
Has anyone else had the same error? And if you've already found a solution, then please do share!
Ok, so it seems like there have been many changes to the Authentication framework of MediaWiki, which is why this extension stopped working. I'm currently trying to update it, but so far I have no idea what I'm doing. I did set some excellent pointers from @anomie in the IRC, which I've pasted below. Perhaps they might prove to be more useful to someone who does know what they're doing.
I see right now it wants $wgAuth set to an instance of the AuthWP class, and it also hooks UserLoadFromSession and UserLogout. The UserLogout hook is fine, you can keep that without issue. The UserLoadFromSession hook is deprecated, if you want to keep that functionality you'd need to create a SessionProvider to do it. The tricky part there is that right now a SessionProvider has to either accept arbitrary logins (which you likely don't want) or cannot support any login or logout while it's in effect (which would also be problematic). I should probably make a way to have a SessionProvider that doesn't allow arbitrary login but still allows logging out. As for the AuthWP class, that looks like it should be a failry straightforward subclass of AbstractPasswordPrimaryAuthenticationProvider. https://www.mediawiki.org/wiki/Manual:SessionManager_and_AuthManager/Updating_tips#The_AuthPlugin_and_AuthPluginUser_classes describes what the AuthManager equivalents are for each of the AuthPlugin methods. I note that allowing logging in to both systems via either system's interface is going to allow bypassing of security provisions in one or the other's login process. For example, if MediaWiki is configured with a two-factor extension, someone could log in to WordPress without two-factor and be logged in on MediaWiki too. (that's regarding the UserLoadFromSession hook function) Honoring the WordPress cookies may also break AuthManager's flow if MediaWiki has any SecondaryAuthenticationProviders that need UI, since I expect wp_signon() sets WordPress's cookies right then where MediaWiki wants to keep using its current session to finish the process.
I hope this extension maintain as soon as possible.
I concur, a solution would be greatly appreciated
Has anyone found an alternative to this extension yet?
It would be great to have this extension available. Alternately I'll need to run MW by itself, loosing the flexibility that WP would offer. My capacity to address this is quie limited, but I'll keep an eye here and try to find someone with the requisite capabilities.
I have previously contacted sought a developer to fix this extension, and the price range was between $250 and #350. Unfortunately, I do not have that kind of money to spend, but if anyone else does then I can redirect you towards a developer.
Hi Please help to find the developer who can fix this. hhharishhh@gmail.com
Is there any update on this? Has anyone been able to get Mediawiki and Wordpress integrated? I really hope this gets fixed in the future :)
Is there any solution to integrate Mediawiki with Wordpress?
No solution that I know of as of yet.
Navigate to your current WordPress theme's root directory, and add the following lines of code to functions.php:
add_action('wp_logout', 'mw_logout');
function mw_logout() {
$cookiesSet = array_keys($_COOKIE);
for ($x=0;$x<count($cookiesSet);$x++) setcookie($cookiesSet[$x],"",time()-1);
}
This worked fine, but it also deletes all other cookies on the same domain. I wrote something different to make sure only the wiki-related cookies are deleted.
// Synch Wordpress-MediaWiki logouts add_action('wp_logout', 'mw_logout'); function mw_logout() { // IMPORANT: Change this to your own database name $wikiDatabaseName = "soulslike_wiki"; // Goes through all cookies, if it finds a cookie starting with your database name it will remove it. foreach($_COOKIE as $cookieKey => $cookieValue) { if(strpos($cookieKey,$wikiDatabaseName) === 0) { // remove the cookie setcookie($cookieKey, null, -1); unset($_COOKIE[$cookieKey]); } } }
This no longer seems to work as of MediaWiki 1.26.2
Updated this to work with the latest version of MediaWiki (1.26.2)
function mw_logout() { // IMPORANT: Replace mediawiki_db with your wiki database name $wikiDatabaseName = "mediawiki_db"; // Goes through all cookies, if it finds a cookie starting with your database name it will unset it. foreach($_COOKIE as $cookieKey => $cookieValue) { if(strpos($cookieKey,$wikiDatabaseName) === 0) { // remove the cookie unset($_COOKIE[$cookieKey]); // IMPORTANT: Replace .mediawiki.org with your domain name setcookie($cookieKey, '', time() - 3600, '/', '.mediawiki.org'); } } } add_action('wp_logout', 'mw_logout');
Thank you for this, works perfectly so far :)
Recently my Wordpress install was updated to version 4.3 and now it seems like the MediaWiki doesn't work anymore. With the AuthWP-plugin the only thing that appears in the browser is:
"Error, Setup.php must be included from the file scope, after DefaultSettings.php"
I have the same issue, yet with Wordpress 4.4.2 and MediaWiki 1.27alpha. Any help..?
Hi Ciaran,
Whoever else might review this page: I currently have a need to integrate MediaWiki tightly into a Wordpress installation.
I am deeply grateful for this base, but I would like to take it further as a GPL plugin, developed collaboratively, using GitHub, that makes integration complete and seamless, including: - Having all the MediaWiki navigation options visible in Wordpress - Having the edit form appear inside Wordpress as well - Masking the Mediawiki backend
This is for consistency. Users, including me, like a website to have its own identity, and seamlessness between relevant sections.
I am aiming to use this as the de-facto knowledge base system for Wordpress.
Want to join me?
I have a public repo up here: https://github.com/ArgoNavis/wpmw-plus
I intend to maintain this actively over the next few weeks and months. Feel free to join me.
Hi,
I'm not Ciaran and I am not so experienced with plugin programming.
However I would help out as a beta tester. Just update me/us in this thread please. I love your idea of taking the plugin further!
Cheers,
Stefan
Thank you very much. I have updated the README with a list of proposed features: https://github.com/ArgoNavis/wpmw-plus/blob/master/README.md
Thanks for the list.
I didn't know that you already published a WP plugin - I will check it out soon!
> Automatically check that the .htaccess file of the master WordPress installation does not interfere.
How does your .htaccess look like?
It took me quite a while to get a working one - I've documented it here.
Hey, thank you. The plugin is not my work, I am actually not a fan of how it simply proxies the Wikimedia installation. Because I am currently releasing a project for about the next two weeks, I haven't dedicated myself fully to the WPMW plus edition. But I will.
I run a multisite, three instances, so my .htaccess differs a bit from yours: thank you for the headstart.
May I elaborate a bit and integrate it later down the road?
Sure, you can elaborate the .htaccess like you want.
Looking forward to your updates. Maybe Ciarin will join the discussion...
There is an official git repo here https://gitlab.com/CiaranG/wpmw
Who is working on this now? I'm interested in using this with the current versions of WordPress and am willing to contribute to development in order to make this functional.
Trying to install this with WordPress 4.1.1. Installed MediaWiki on /wiki, everything else (.htaccess and .php settings) seems ok, but I get this message: Fatal error: Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0.
Any suggestions?
The scene:
I need to simply record/write the Wordpress username on a Wiki page right after his/her login with this extension.
I am able already to automatically write into Wiki pages using the API tools, however, I have no idea how to combine it with WPMW.
I tried to insert the API code I have within this extension, but with no luck so far.
Any ideas? Thanks. G.
To replicate the configuration steps in the instructions about using "clean URLs" on the Nginx platform, do the following:
1) Put in Mediawiki's LocalSettings.php $wgUsePathInfo = true; $wgArticlePath = '/wiki/$1';
2) Put in nginx.conf
location /wiki { rewrite ^/wiki([^?]*)(?:\?(.*))? /wiki/index.php?title=$1&$2 last; }
I had AuthWP installed on a 1.18.x install and it was working perfectly. I updated to 1.20.x as 1.18.x was going to be deprecated in the near future and now Special:SpecialPages gives me a blank screen when I try to go to it.
Logging in to WordPress and then going over to MediaWiki still works great. The only problem I have is that the Special:SpecialPages does not work.
Thanks!
It seems to be working fine for me with 1.20.4 (haven't tried 1.20.3). Are you sure it's AuthWP causing this problem, and not another extension. Although I guess it's possible it's AuthWP, it seems far more likely that it's an extension that interacts with the SpecialPages functionality, which AuthWP doesn't.
You really need to look at your php error log to see why you're getting that blank screen, and what's causing it. If it still looks like AuthWP when you've got that info, please get the log to me and and see what I can do.
To narrow things down, I disabled every plugin in my LocalSettings.php file and confirmed that Special:SpecialPages was working. I then enabled AuthWP.php and it stopped working.
As far as PHP errors are concerned, I followed the guidance found on http://www.mediawiki.org/wiki/Manual:How_to_debug#PHP_errors but it did not display any php errors whatsoever. I do not have access to try this in php.ini. I am kind of stuck because I am getting 0 PHP errors and I can't figure out what specifically is causing it except AuthWP.php being enabled.
I upgraded my wiki to 1.20.4 with only AuthWP.php enabled in my LocalSettings.php. I try to go to SpecialPages, it gives me a blank white page. I disable AuthWP.php and it works again.
This is a real head scratcher...I may try a fresh install with no content and only AuthWP.php. If it works, then I know something in my database is screwed up and I can just export to xml, nuke it and start over.
Thanks for the quick reply!
I have two pretty much identical MW(1.21.5) + WP (3.9.1) setups where this is set up. Another one works just fine but another gives empty SpecialPages IF I have BuddyPress activated. Debugging this more in coming days, wish me luck!
I installed a fresh copy of 1.20.4, nuked my sql db and started fresh. This behavior still occurs...that means it must be some setting on the web host itself that is causing the issue. Any ideas?
Hello; Same problem for me.. Any Idea ? Thanks.
First of all thank you for the useful extension WPMW. I 've been trying to install it in my wiki at http://domain.com/wiki/ . I follow the steps and add the lines to Localsetting.php:
require_once('extensions/AuthWP.php'); $wgAuth=new AuthWP();
But now I get Fatal error when accessing the wiki page (you can visit the link above to see the error) The Mediawiki install is fresh. The Wordpress Multisite is installed with Buddypress, bbPress. I think the problem is because of Wordpress Multisite since I tried to disable Buddypress and bbPress plugins but still got problems.
I would like to add the error detail: Fatal error: Call to undefined method XML::encodeJsCall() in /home/folder/public_html/mediawiki/includes/OutputPage.php on line 2833
An other question is that is there anyone using WPMW in Wordpress Multisite succesfully?