summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-05-19 16:19:06 -0700
committerBrion Vibber <brion@pobox.com>2010-05-19 16:19:06 -0700
commit708d22848ecffdb80ca2cd9e5f4a7f84d5ae3189 (patch)
tree1cd525db73644537610955780248e1bd1b5e6d71
parentad651c35353021d05ef4a013e57c17d0b885c5dc (diff)
Quick fix for creating OpenID accounts authenticating against a MediaWiki site; trim the 'User:' etc from the final path segment before generating a nickname from it. Avoids ending up with nicks like 'userbrion' on your first OpenID login!
-rw-r--r--lib/util.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php
index 597da22c0..59d5132ec 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1925,6 +1925,15 @@ function common_url_to_nickname($url)
$path = preg_replace('@/$@', '', $parts['path']);
$path = preg_replace('@^/@', '', $path);
$path = basename($path);
+
+ // Hack for MediaWiki user pages, in the form:
+ // http://example.com/wiki/User:Myname
+ // ('User' may be localized.)
+ if (strpos($path, ':')) {
+ $parts = array_filter(explode(':', $path));
+ $path = $parts[count($parts) - 1];
+ }
+
if ($path) {
return common_nicknamize($path);
}