Extension:AddPersonalUrls

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
AddPersonalUrls

Release status: stable

AddPersonalUrls-screenshot.png
Implementation MyWiki, Skin
Description Add some items to the personal URLs.
Author(s) (RV1971talk)
Latest version 1.1.0 (2014-08-25)
MediaWiki >=1.21
PHP 5.3
License GNU General Public License 3.0 or later
Download Sourceforge
Release Notes
Parameters
  • $wgAddPersonalUrlsTable
Hooks used
BeforePageDisplay

EditFormPreloadText
PersonalUrls

Translate the AddPersonalUrls extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

The AddPersonalUrls extension adds some items to the personal URLs (the links which in the Vector skin are located near the top of the screen). While it is totally configurable, it comes with a default configuration that adds the following:

  • A link to the list to all subpages of the user's home page.
  • Links to subpages Home, Favorites, Sandbox and Notes of the user's home page.

At the beginning, the new subpages are filled with a configurable default text explaining their purpose. Each user can edit them acccording to personal needs.

Installation[edit | edit source]

  • Download and extract the tarball in your extensions/ folder. It should generate a new folder called AddPersonalUrls directly inside your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
require_once "$IP/extensions/AddPersonalUrls/AddPersonalUrls.php";
  • Done! Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

To upgrade an existing installation, replace the files with new ones. If you have customized it in any way, check the release notes for instructions on configuration changes.

Even though this extension has been tested on MediaWiki 1.21 only, it is likely to work on slightly earlier versions as well.

Configuration[edit | edit source]

Table of URLs[edit | edit source]

The additional URLs are defined in the global variable $wgAddPersonalUrlsTable, which you may customize in your LocalSettings.php. A default table is used if you do not provide a custom one. The table is an array where each entry assigns an ID to a (partial) URL as follows:

  • URLs are inserted after the link to the user's home page, in the order in which they appear in the array.
  • The ID is the name of a system message used to display the link. AddPersonalUrls is shipped with default messages (in the languages de, en, fr and it) for the links in the default $wgAddPersonalUrlsTable.
  • The URL is either a page name (without brackets), optionally followed by a '?' and a query string, or an external link. A URL is recognized an external link iff it contains the string '://'. I'm sure you'll find a better way, so please let me know your ideas.
  • The string $username will be replaced with the current username. Note that in LocalSettings.php, you need to write the URL within single quotes to avoid that PHP already interprets $username while processing LocalSettings.php, in which case it would evaluate to an empty string.

The default content of $wgAddPersonalUrlsTable is currently as follows:

$wgAddPersonalUrlsTable = array(
	'addpersonalurls-userpages' 
	=> 'Special:PrefixIndex?prefix=$username&namespace=2',
	'addpersonalurls-home' => 'User:$username/Home',
	'addpersonalurls-favorites' => 'User:$username/Favorites',
	'addpersonalurls-sandbox' => 'User:$username/Sandbox',
	'addpersonalurls-notes' => 'User:$username/Notes'
);

Messages[edit | edit source]

addpersonalurls-desc
Description of this extension as shown in Special:Version.
addpersonalurls-preload
When a user clicks on a personal URL and the corresponding page does not exist, the result is a create-page screen with this text preloaded.
addpersonalurls-userpages
Description of the link which displays the subpages of User:$username where $username is the user currently logged in.
addpersonalurls-home
Description of the link which displays the subpage User:$username/Home where $username is the user currently logged in.
addpersonalurls-home-preload
When a user clicks on the addpersonalurls-home link and the corresponding page does not exist, the result is a create-page screen with the text of the addpersonalurls-preload message plus this text preloaded.
addpersonalurls-favorites
Description of the link which displays the subpage User:$username/Favorites where $username is the user currently logged in.
addpersonalurls-favorites-preload
When a user clicks on the addpersonalurls-favorites link and the corresponding page does not exist, the result is a create-page screen with the text of the addpersonalurls-preload message plus this text preloaded.
addpersonalurls-sandbox
Description of the link which displays the subpage User:$username/Sandbox where $username is the user currently logged in.
addpersonalurls-sandbox-preload
When a user clicks on the addpersonalurls-sandbox link and the corresponding page does not exist, the result is a create-page screen with the text of the addpersonalurls-preload message plus this text preloaded.
addpersonalurls-notes
Description of the link which displays the subpage User:$username/Notes where $username is the user currently logged in.
addpersonalurls-notes-preload
When a user clicks on the addpersonalurls-notes link and the corresponding page does not exist, the result is a create-page screen with the text of the addpersonalurls-preload message plus this text preloaded.

When a personal page does not exist, the URL opens the page for editing, and the content of the system messages ID-preload and addpersonalurls-preload is preloaded. This will also work for any URLs you add, provided that ID is equal to addpersonalurls-subpage_title_in_lowercase.

CSS[edit | edit source]

In the resulting HTML code, each link is wrapped into an <li> element having an id attribute with value pt-ID. This is a feature provided by MediaWiki and allows to format personal URLs individually via CSS.

The AddPersonalUrls exension uses this feature to add icons, taken from the Wikicommons Nuvola icons, to the new links as well as to the existing ones provided by MedaWiki. You can override this with your own CSS.

Release notes[edit | edit source]

These are the release notes for version 1.1.0. See Extension:AddPersonalUrls/History for older releases.

Configuration changes[edit | edit source]

Language: English  • русский