Extension:ConditionalShow
From MediaWiki.org
For further details, see Security issues with authorization extensions
|
Release status: stable |
|||
|---|---|---|---|
| Implementation | Tag, User rights, MyWiki | ||
| Description | Conditionally show a wikitext section based on user group rights | ||
| Last Version | 1.5 (2009-09-10) | ||
| MediaWiki | tested on 1.8.2, 1.9.3, 1.10, 1.14, 1.15, 1.16A | ||
| License | GNU General Public Licence 2.0 | ||
| Download | Download snapshot |
||
| Example | examples | ||
|
|||
|
|||
|
check usage (experimental) |
|||
Contents |
[edit] What can this extension do?
This extension implementes the <cshow> tag which conditionally shows wikitext within the tags based on user group rights and certain other parameters.
Using the tags should be to make the user experience less confusing or more useful by only showing information relevant to the user and specific groups that user belongs to.
PLEASE NOTE!!!
This tag does not protect information or instructions from being disclosed to the reader.
The user can still see the information by editing the page or even by "view source". If you are looking to actually protect information, this is NOT the extension you want to use!
This extension only helps you selectively show content or navigation based on groups the user belongs to.
[edit] Note
This extension is not 'cache' friendly; if one requires this feature, then BizzWiki platform provides a solution through Parser Phase 2 extension.
[edit] Usage
Like other tags, this can be used two ways - by using the tag itself within wikitext, or by using the tag function within templates.
If you are using it within normal wikitext, the <cshow>. . .</cshow> syntax suffices. If you are using it within a template, you will need to use the parser tag function as illustrated below.
[edit] Example in Wikitext
By default, the section of wikitext within the tags is HIDDEN unless the conditions are met - in this case the user must be logged in and belong the group 'sysops'
<cshow logged=1 ingroup='sysop'> This text will appear if a user with membership to 'sysop' group views this page</cshow>
[edit] Example within a Template
If you are using this within a template or as part of a template, you need to use the {{#tag: . . .}} syntax.
{{#tag:cshow |
This text will appear if a user with membership to 'sysop' group views this page
| logged=1 ingroup='sysop'
}}
For documentation on how to use the #tag parserfunction, Miscellaneous Magic Words
[edit] Arguments
By default, the tagged section is HIDDEN unless the following conditions are met:
- Argument: logged = '1' or '0'
- Argument: ingroup = 'group XYZ' (Note, as of version 1.5, you can list multiple groups, e.g. 'sysop,approved'
If no arguments are provided for: logged --> assume 'don't care' innGroup --> assume (no group)
In other words, if no 'ingroup' parameter is given, then the condition 'ingroup' is never met.
If no "logged" parameter is given, then this condition is always met.
[edit] Download instructions
The current version is available from SVN.
Source Code and additional information can also be found at [1]. The code should be loaded to:
$IP/extensions/ConditionalShowSection/ConditionalShowSection.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
[edit] Installation
To install this extension, add the following to LocalSettings.php:
require_once("$IP/extensions/ConditionalShowSection/ConditionalShowSection.php");
[edit] Announcements
- The text in the conditionalshowsection-desc contained <cshow> which is causes Special:Version to choke. Updated messages so it no longer contains that tag (which should not have been interpreted). This will cause a problem in Special:Version for all versions before MW 1.16.0, so if you are seeing it, download the current message files to correct.