forked from GNUsocial/gnu-social
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!
This commit is contained in:
parent
ad651c3535
commit
708d22848e
@ -1925,6 +1925,15 @@ function common_url_to_nickname($url)
|
|||||||
$path = preg_replace('@/$@', '', $parts['path']);
|
$path = preg_replace('@/$@', '', $parts['path']);
|
||||||
$path = preg_replace('@^/@', '', $path);
|
$path = preg_replace('@^/@', '', $path);
|
||||||
$path = basename($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) {
|
if ($path) {
|
||||||
return common_nicknamize($path);
|
return common_nicknamize($path);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user