A powerful DokuWiki plugin that provides dynamic text replacement for user information, dates, groups, and other runtime data. Pages using this plugin are automatically non-cacheable to ensure fresh content.
- Dynamic User Information: Display current user details, groups, and authentication status
- Date and Time Variables: Current dates, timestamps, and time-based values
- Page Context: Current page name and namespace information
- Random Values: Generate random numbers for dynamic content
- Automatic Cache Control: Pages with runtime variables are automatically non-cacheable
- Session-Based Authentication Information: Compatible with various auth plugins including authchained used with authplain+authldap
- Download and install the plugin in your DokuWiki
lib/plugins/directory - The plugin should be located at:
lib/plugins/runtimevar/ - Enable the plugin in DokuWiki's configuration if necessary
- There is no language and configuration support (needed)
Note: This plugin is not available via DokuWiki's official plugin manager as it's hosted on GitHub only.
cd /path/to/your/dokuwiki/lib/plugins
git clone https://github.com/cs1969/dokuwiki-plugin-runtimevar.git runtimevar
# On Debian/Ubuntu systems:
chown -R www-data:www-data runtimevar- Download the latest source code from GitHub
- Click "Code" → "Download ZIP"
- Extract and rename the folder to runtimevar
- Upload to lib/plugins/runtimevar/ in your DokuWiki installation
- Ensure proper file permissions
Use the following syntax in your wiki pages:
{{runtimevar #METHOD}}
Replace #METHOD with one of the available methods below.
| Method | Description | Example Output |
|---|---|---|
#USER |
User login name | john_doe or guest |
#USERNAME |
User display name | John Doe or Unregistered guest user |
#GROUPS |
User groups (comma-separated) | USER, ADMIN, ALL, other Auth Groups |
| Method | Description | Example Output |
|---|---|---|
#YY |
Two-digit year | 24 |
#YYYY |
Four-digit year | 2024 |
#MM |
Month with leading zero | 01 - 12 |
#DD |
Day with leading zero | 01 - 31 |
#YYYY-MM-DD |
ISO date format | 2024-01-13 |
#YYYY-MM-DD-HH-MM-SS |
Full timestamp | 2024-01-13-10-30-45 |
#YYYYMMDD |
Compact date format | 20240113 |
#HHMMSS |
Time format | 103045 |
#HH-MM-SS |
Time with separators | 10-30-45 |
#TIMESTAMP |
Unix timestamp | 1705141845 |
| Method | Description | Example Output |
|---|---|---|
#PAGE |
Current page name without namespace | start |
#NAMESPACE |
Current namespace | wiki or : for root |
| Method | Description | Example Output |
|---|---|---|
#RANDOM |
Random number | 54872 |
#USERAGENT |
Browser user agent | Mozilla/5.0... |
#IP |
Client IP address | 192.168.1.100 |
Hello {{runtimevar #USERNAME}}! You are logged in as {{runtimevar #USER}} and belong to groups: {{runtimevar #GROUPS}}.
This page was generated on {{runtimevar #YYYY-MM-DD}} at {{runtimevar #HH-MM-SS}}. Current timestamp: {{runtimevar #TIMESTAMP}}
[[:start]][[private:{{runtimevar #USER}}:start|My Private Area]][[special:page_{{runtimevar #YYYYMMDD}}|Today's Special]]
The #GROUPS method provides intelligent group management (Information):
- Authenticated users: Show their actual groups + default group + ALL group
- Guest users: Always show the ALL group
- Default group: Automatically added and shown in UPPERCASE if not present
- ALL group: Always shown for all users
- Case handling: ADMIN, ALL, and default group (normaly USER) are always uppercase
Note: This maybe useful for ACL related issues. Just show the current user groups with {{runtimevar #GROUPS}} in any page...
Important: Pages containing {{runtimevar}} patterns are automatically marked as non-cacheable. The plugin:
- Adds
~~NOCACHE~~flag to pages with runtime variables - Forces cache expiration on every request
- Ensures fresh content for all users
- No manual
~~NOCACHE~~markup required
- Unknown methods return:
?runtimevar? - Robust fallback mechanisms for user detection
- Session-based authentication for reliability
- Compatible with various DokuWiki auth plugins
- The plugin hooks into
PARSER_WIKITEXT_PREPROCESSfor early processing - Uses session data (
$_SESSION[DOKU_COOKIE]) for reliable user detection - Compatible with authchained and other authentication plugins
- All virtual groups (DEFAULT, ALL) are displayed in uppercase
This plugin was initially developed for internal intranet use and is provided as-is. While it's stable for our use case, it may not cover all edge cases for public deployments.
For community usage:
- Feel free to fork the repository for your own modifications
- Create issues for bug reports in the repository
- Feature requests are welcome but may not be implemented by the maintainer
- Consider creating your own fork for significant extensions
Note: There are no current plans to submit this plugin to the official DokuWiki repository.
Contact: dokuwiki@schmifu.de (Christian)
RuntimeVar Plugin - Making DokuWiki content more dynamic and user-aware!