Extension:VarsInSession

What can this extension do?
This is a simple extension that allows the creation/usage of persistent variables in the Session object through three parser functions. These variables persist across multiple HTTP requests until the session cookie is removed or expires from the browser. By default this is when the user closes their browser.

Usage
The #svarset and #svar-set parser functions are synonyms, and set a variable to the given value. The parameter is required. The is optional, and will be the null value if not provided.

The #svarget and #svar-get parser functions are synonyms, and get the value of a variable. The parameter is required. The is optional, and is the returned value if does not exist.

The #svar-isset parser function returns "true" if the variable has been previously set, or returns the empty string if the variable has not previously been set.

NOTE: Some versions of Mediawiki do not create a $_SESSION global object variable for users that are not logged in, or it is created very late in the startup sequence. If you find you are having trouble with variables you set with this extension not persisting, it may be due to the lack of $_SESSION. In order to ensure this object exists prior to use, add this code to your LocalSettings.php: global $wgSessionStarted; if (! $wgSessionStarted) { wfSetupSession; }

Download instructions
Please cut and paste the code found below and place it in. Note: stands for the root directory of your MediaWiki installation, the same directory that holds .

Installation
To install this extension, add the following to :

Parser caching must also be disabled to ensure each invocation of #svarset and #svarget are working with values from the Session object of the current user. Add this line to your LocalSettings.php file:

$wgEnableParserCache = false;