Get ride of the username in links when user is logged in.
authorAntoine Musso <hashar@users.mediawiki.org>
Wed, 26 Jan 2005 09:34:28 +0000 (09:34 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Wed, 26 Jan 2005 09:34:28 +0000 (09:34 +0000)
Instead use special pages just like the already existent [[Special:Watchlist]].
That's one more step to get pages rendered for logged users cached.

includes/SkinTemplate.php
includes/SpecialMycontributions.php [new file with mode: 0644]
includes/SpecialMypage.php [new file with mode: 0644]
includes/SpecialMytalk.php [new file with mode: 0644]
includes/SpecialPage.php

index cfca563..c3ac8de 100644 (file)
@@ -410,16 +410,14 @@ class SkinTemplate extends Skin {
                global $wgShowIPinHeader;
                $personal_urls = array();
                if ($this->loggedin) {
+                       /* Logged in users personal toolbar */
                        $personal_urls['userpage'] = array(
-                               'text' => $this->username,
-                               'href' => &$this->userpageUrlDetails['href'],
-                               'class' => $this->userpageUrlDetails['exists']?false:'new'
+                               'text' => wfMsg('mypage'),
+                               'href' => $this->makeSpecialUrl('Mypage')
                        );
-                       $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
                        $personal_urls['mytalk'] = array(
                                'text' => wfMsg('mytalk'),
-                               'href' => &$usertalkUrlDetails['href'],
-                               'class' => $usertalkUrlDetails['exists']?false:'new'
+                               'href' => $this->makeSpecialUrl('Mytalk')
                        );
                        $personal_urls['preferences'] = array(
                                'text' => wfMsg('preferences'),
@@ -431,7 +429,7 @@ class SkinTemplate extends Skin {
                        );
                        $personal_urls['mycontris'] = array(
                                'text' => wfMsg('mycontris'),
-                               'href' => $this->makeSpecialUrl('Contributions','target=' . urlencode( $this->username ) )
+                               'href' => $this->makeSpecialUrl('Mycontributions')
                        );
                        $personal_urls['logout'] = array(
                                'text' => wfMsg('userlogout'),
@@ -439,23 +437,22 @@ class SkinTemplate extends Skin {
                        );
                } else {
                        if( $wgShowIPinHeader && isset(  $_COOKIE[ini_get("session.name")] ) ) {
+                               /* Anonymous with session users personal toolbar */
                                $personal_urls['anonuserpage'] = array(
-                                       'text' => $this->username,
-                                       'href' => &$this->userpageUrlDetails['href'],
-                                       'class' => $this->userpageUrlDetails['exists']?false:'new'
+                                       'text' => wfMsg('mypage'),
+                                       'href' => $this->makeSpecialUrl('Mypage')
                                );
-                               $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
-                               $personal_urls['anontalk'] = array(
-                                       'text' => wfMsg('anontalk'),
-                                       'href' => &$usertalkUrlDetails['href'],
-                                       'class' => $usertalkUrlDetails['exists']?false:'new'
+                               $personal_urls['mytalk'] = array(
+                                       'text' => wfMsg('mytalk'),
+                                       'href' => $this->makeSpecialUrl('Mytalk')
                                );
+
                                $personal_urls['anonlogin'] = array(
                                        'text' => wfMsg('userlogin'),
                                        'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl )
                                );
                        } else {
-
+                               /* Anonymous users personal toolbar */
                                $personal_urls['login'] = array(
                                        'text' => wfMsg('userlogin'),
                                        'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl )
diff --git a/includes/SpecialMycontributions.php b/includes/SpecialMycontributions.php
new file mode 100644 (file)
index 0000000..f75f375
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+function wfSpecialMycontributions() {
+       global $wgUser, $wgOut;
+       $t = Title::makeTitle( NS_SPECIAL, 'Contributions' );
+       $wgOut->redirect ( $t->getFullURL().'&target='.$wgUser->getName() );
+}
+?>
\ No newline at end of file
diff --git a/includes/SpecialMypage.php b/includes/SpecialMypage.php
new file mode 100644 (file)
index 0000000..edc1fd8
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+function wfSpecialMypage() {
+       global $wgUser, $wgOut;
+       $t = Title::makeTitle( NS_USER, $wgUser->getName() );
+       $wgOut->redirect ($t->getFullURL());
+}
+?>
\ No newline at end of file
diff --git a/includes/SpecialMytalk.php b/includes/SpecialMytalk.php
new file mode 100644 (file)
index 0000000..71e8bf7
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+function wfSpecialMytalk() {
+       global $wgUser, $wgOut;
+       $t = Title::makeTitle( NS_USER_TALK, $wgUser->getName() );
+       $wgOut->redirect ($t->getFullURL());
+}
+?>
\ No newline at end of file
index c7f1f64..27bf4b1 100644 (file)
@@ -31,6 +31,11 @@ $wgSpecialPages = array(
        'Userlogout'        => new UnlistedSpecialPage( 'Userlogout' ),
        'Preferences'       => new SpecialPage( 'Preferences' ),
        'Watchlist'         => new SpecialPage( 'Watchlist' ),
+       
+       'Mytalk'                        => new UnlistedSpecialPage( 'Mytalk'),
+       'Mycontributions'       => new UnlistedSpecialPage( 'Mycontributions'),
+       'Mypage'                        => new UnlistedSpecialPage( 'Mypage'),
+       
        'Recentchanges'     => new SpecialPage( 'Recentchanges' ),
        'Upload'            => new SpecialPage( 'Upload' ),
        'Imagelist'         => new SpecialPage( 'Imagelist' ),