[Mediawiki-l] Patch for generic link to logged user page

Jej jejc at free.fr
Fri Apr 29 11:39:38 UTC 2005


>> Is it possible, in an article, to have a link to the current logged user
>> page ? Something like [[User:~]] to go to [[User:JohnDoe]] whether
>> JohnDoe is the user actually logged.
>
>
> [[Special:Mypage]] does this in 1.5. Note that it does not change the
> text of the link, as page text is fixed when saved; it redirects to the
> current user's user page when it's visited.
>
> -- brion vibber (brion @ pobox.com)


To wait until the 1.5 stable is released, here is a simple patch to 
enable the notation : [[User:~|My page]]

Hope it will be useful!

jej



--- old/index.php   2005-04-27 14:04:15.000000000 +0200
+++ index.php   2005-04-29 13:36:49.411985032 +0200
@@ -37,6 +37,14 @@
        $wgOut->setPrintable();
 }

+if ($title == ($ns=$wgContLang->getNsText( NS_USER )).':~') {
+    $un = $wgUser->getName();
+    if (substr($un, 0, 2)!="::")
+        $title = "$ns:$un";
+    else
+        $title = '';
+}
+
 if ( '' == $title && 'delete' != $action ) {
        $wgTitle = Title::newFromText( wfMsgForContent( 'mainpage' ) );
 } elseif ( $curid = $wgRequest->getInt( 'curid' ) ) {




More information about the MediaWiki-l mailing list