PlayerHUD Availability Restriction

Access-restriction condition for the PlayerHUD gamification ecosystem — full documentation.

English | Português

View on GitHub Download .zip

Moodle License Status Latest Release PlayerGames Ecosystem Role Author

Moodle Plugin CI MDL Shield Last Commit Open Issues

The PlayerHUD Availability Condition is a required-companion extension for the PlayerHUD Block. It lets teachers restrict access to activities, resources, or course sections based on a student’s progress in PlayerHUD.

It plugs directly into Moodle’s native Restrict access system, unlocking content only when a student reaches a specific Level, owns a required Item, belongs to a Character class, or has gamification active.

👈 Use the sidebar to jump to any section on this page.


✨ Features

🕹️ PlayerGames Ecosystem

This plugin is part of the PlayerGames gamification ecosystem. Together, these plugins transform Moodle into an immersive experience:

🧩 Optional Integration: Report Unlocker

PlayerHUD restrictions are normally configured and edited one activity at a time, through each activity’s own Restrict access panel (see Usage). The separate Report Unlocker report plugin (report_unlocker, by the same author, but not part of the PlayerGames family) adds a course-wide dashboard that lists every access restriction in the course — including PlayerHUD Level, Item, Character, and Gamification conditions — with inline editing, bulk removal, and an AI assistant for natural-language changes. Report Unlocker reads and writes the same {course_modules}.availability JSON this plugin produces, always scoped to the course’s own PlayerHUD block instance, so nothing changes in how the restriction is stored. Without Report Unlocker installed, restrictions still work exactly as documented in Usage — only the bulk, course-wide dashboard is unavailable.

👉 https://github.com/jeanlucio/moodle-report_unlocker

📦 Requirements

Component Version
Moodle 4.5+
PHP Compatible with your Moodle version
Required dependency PlayerHUD Block

🛠️ Installation

  1. Ensure the PlayerHUD Block is installed first: 👉 https://github.com/jeanlucio/moodle-block_playerhud This availability condition depends on the block and will not function without it.
  2. Download the .zip file or clone this repository.
  3. Extract the folder into your Moodle availability/condition/ directory.
  4. Rename the folder to playerhud (if necessary). Final path: your-moodle/availability/condition/playerhud/
  5. Visit Site administration > Notifications to complete installation.

📖 Usage

  1. Add the PlayerHUD Block to the course (see Installation) — the restriction option only appears in courses where a PlayerHUD block instance exists.
  2. Turn Edit mode on in the course.
  3. Edit an activity, resource, or section.
  4. Open the Restrict access section and click Add restriction…
  5. Select PlayerHUD.
  6. Choose the restriction type and its parameters (see the reference table below).

Students only gain access once the defined condition is met; the description shown to them is generated dynamically from the same condition.

Restriction Type Reference

Type Parameters Access granted when
Minimum Level Required level The student’s current PlayerHUD level is greater than or equal to the configured level.
Own Item Item, operator (at least, more than, less than, exactly), quantity The student’s inventory count for the selected item satisfies the chosen operator against the configured quantity.
Character RPG class The student has the selected RPG class assigned in their PlayerHUD progress.
Gamification Enabled The student has not paused/opted out of gamification in the course’s PlayerHUD block.

Notes

🧪 Automated Tests

The plugin ships with unit/integration (PHPUnit) and browser acceptance (Behat) tests, executed on every CI push against the full Moodle 4.5 → 5.2 matrix (PostgreSQL & MariaDB).

PHPUnit — Unit & Integration Tests

Test file Cases
backup/restore_test.php 2
condition_test.php 24
frontend_test.php 5
privacy/provider_test.php 1
Total 32
vendor/bin/phpunit --testsuite availability_playerhud

Overall line coverage (PHPUnit + Xdebug): 94%.

Behat — Acceptance Tests

Feature file Scenarios
allow_add.feature 2
restriction_level.feature 2
restriction_gamification.feature 2
Total 6
php admin/tool/behat/cli/init.php
vendor/bin/behat --tags=@availability_playerhud --profile=chrome

Full test-by-test breakdown and coverage table →

🔐 Security & Compliance

Privacy Provider

The PlayerHUD Availability Condition implements Moodle’s null_provider — it only reads data owned and stored by the PlayerHUD Block (level, inventory, RPG class, gamification status) to compute an access decision; it never persists any personal data of its own. See the block’s own documentation for its full GDPR export/delete coverage.

📄 License

This project is licensed under the GNU General Public License v3 (GPLv3).

Copyright: 2026 Jean Lúcio