- $pos = strpos( $userName, '>' );
- if ( $pos !== false ) {
- $iw = explode( ':', substr( $userName, 0, $pos ) );
- $firstIw = array_shift( $iw );
- $interwikiLookup = MediaWikiServices::getInstance()->getInterwikiLookup();
- if ( $interwikiLookup->isValidInterwiki( $firstIw ) ) {
- $title = MWNamespace::getCanonicalName( NS_USER ) . ':' . substr( $userName, $pos + 1 );
- if ( $iw ) {
- $title = join( ':', $iw ) . ':' . $title;
- }
- $page = Title::makeTitle( NS_MAIN, $title, '', $firstIw );
- }
+ $page = ExternalUserNames::getUserLinkTitle( $userName );
+
+ if ( ExternalUserNames::isExternal( $userName ) ) {