Plugin: wvdscond
Version: 1.0.0
Namespace: lib/plugins/wvdscond/
Author: Wolfgang van der Stille zeljko.petrusic@outlook.de
License: GPL 2
wvdsif plugin and extends it with redirect functionality.
The existing syntax <ifgroup>, <ifnotgroup> and <iflang> remains fully compatible.
The wvdscond plugin combines conditional content display and server-side redirects in one plugin. It provides:
<ifgroup>, <ifnotgroup>, <iflang>redirect_target with variable support<ifgroup !guest> or <ifnotgroup guest><ifgroup groupname>Content for this group</ifgroup> <ifgroup group1,group2>Content for multiple groups</ifgroup> <ifgroup !guest>Content for NON-guests</ifgroup>
<ifnotgroup guest>Content for logged-in users</ifnotgroup> <ifnotgroup admin>Content for non-admins</ifnotgroup>
<iflang languagecode>Content for this language</iflang> <iflang code1,code2>Content for multiple languages</iflang> <iflang *>Fallback content (always shown)</iflang>
{{wvds:redirect target="de:start"}}
{{wvds:redirect target="{lang}:start"}}
{{wvds:redirect target="int:home" ifgroup="user"}}
{{wvds:redirect target="{lang}:pub:start" ifnotgroup="user"}}
| Variable | Replaced by | Example |
|---|---|---|
{lang} | Browser language | de, en, sl |
{group} | First user group | user, admin, vip |
{user} | Username | wvds |
{ns} | Current namespace | de:docs |
| Parameter | Type | Description |
|---|---|---|
target | Required | Target page (Page-ID or with variables) |
ifgroup | Optional | Redirect only for this group(s) |
ifnotgroup | Optional | Redirect only if NOT in group(s) |
| Parameter | Type | Description |
|---|---|---|
guest | predefined | Non-logged-in visitors |
user | predefined | All logged-in users |
admin | predefined | Administrators |
[groupname] | user-defined | Any group defined in DokuWiki |
Requirement: Start page automatically redirects to browser language.
{{wvds:redirect target="{lang}:start"}}
Result:
de:starten:startsl:startRequirement: Guests are redirected to a public page, logged-in users stay.
{{wvds:redirect target="pub:start" ifnotgroup="user"}}
Result:
pub:startRequirement: Non-VIPs are redirected to info page.
{{wvds:redirect target="info:upgrade" ifnotgroup="vip,premium"}}
<ifgroup vip,premium>
===== VIP Area =====
Welcome to the exclusive area!
</ifgroup>
Requirement: Greetings in different languages.
~~NOCACHE~~ <iflang de> ===== Willkommen ===== Dies ist unsere Wissensdatenbank auf Deutsch. </iflang> <iflang en> ===== Welcome ===== This is our knowledge base in English. </iflang> <iflang *> ===== Welcome ===== Please select your language. </iflang>
Requirement: Admin links only visible for admins.
~~NOCACHE~~ ===== Navigation ===== * [[.:start|Start Page]] * [[.:docs:index|Documentation]] <ifnotgroup guest> * [[.:intern:index|Internal Area]] </ifnotgroup> <ifgroup admin> * [[.:admin:index|Administration]] </ifgroup>
1. Pattern Recognition
└── Finds {{wvds:redirect ...}}
2. Condition Check (if present)
├── ifgroup: Checks group membership
└── ifnotgroup: Checks NON-membership
3. Variable Replacement
├── {lang} → Browser language
├── {user} → Username
├── {group} → First group
└── {ns} → Current namespace
4. Redirect Execution
├── HTTP 301/302 header (preferred)
├── Meta-Refresh (fallback)
└── JavaScript (fallback)
The plugin requires no special configuration. Group detection uses standard DokuWiki ACL groups.
so content is re-rendered on each request.
| Old (wvdsif) | New (wvdscond) | Status |
|---|---|---|
<ifgroup user> | <ifgroup user> | Compatible |
<iflang de> | <iflang de> | Compatible |
| - | <ifnotgroup guest> | NEW |
| - | redirect | NEW |
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | 2026-01-29 | Initial release |
File: lib/plugins/wvdscond/syntax.php
| Method | Description |
|---|---|
getType() | Returns substition |
getSort() | Returns 100 |
connectTo($mode) | Registers ifgroup, ifnotgroup, iflang, redirect patterns |
handle($match, …) | Parses tag and extracts condition |
render($mode, …) | Returns content, redirect, or empty |
File: lib/plugins/wvdscond/helper.php
| Method | Description |
|---|---|
getUserGroups() | Returns all user groups |
checkGroup($groups) | Checks if user is in group |
checkNotGroup($groups) | Checks if user is NOT in group |
detectBrowserLang() | Detects browser language |
checkLang($langs) | Checks language match |
replaceVariables($target) | Replaces {lang}, {user}, etc. |