PlayerGroup lets students autonomously form their own groups directly from the activity page โ no teacher intervention needed. It replaces manual group assignment with a self-service experience that works for any course format.
๐ Use the sidebar to jump to any section on this page.
๐ผ๏ธ Screenshots
Browse with the arrows, the dots, or the left/right keys. Click the image to zoom.
The activity appears on the course page like any other resource
โจ Features
- ๐ฅ Group Creation: Students create groups with a custom name, description, and emoji badge โ no teacher intervention needed.
- ๐ Privacy Levels: Open, protected (password), and closed (invite only).
- ๐จ Invite System: Peer invitations via Moodleโs native notification (bell + email for offline users); the invite picker is gated by
moodle/course:viewparticipantsand filtered to actively enrolled students, matching the same visibility rules as the rest of the course. - ๐ View Members: Every group cardโs member count is a button that opens a read-only list of that groupโs members, with the founder marked as leader โ on both the web view and the mobile app.
- โ๏ธ Configurable Limits: Teachers set minimum and maximum members per group.
- ๐๏ธ Automatic Grouping: A Moodle grouping is created automatically โ no manual setup required. Deleting the activity only ever removes the groups and grouping it actually created; if the teacher pointed it at a pre-existing grouping instead, that grouping and any groups not registered by this activity are left untouched.
- ๐ Concurrency-Safe: Creating, joining, or accepting an invite into a group is serialised per activity instance, so two near-simultaneous requests (a double-click, or two devices) can never place the same student in two groups at once or push a group past its member limit.
- ๐ Gradebook Integration: Grade awarded automatically when a student joins or creates a group; permanent even if the student later leaves.
- โ Activity Completion: Custom rule โ student must join or create a group.
- ๐ Teacher Reports:
- Activity Log: Audit view of the last 200 events (group created, joined, left, invite accepted), with CSV and Excel export.
- Groups and Members: One row per member โ group, privacy, role (leader/member), and name โ for a full class roster at a glance, also exportable to CSV and Excel.
- ๐ Groups API: Full integration with Moodleโs native groups and groupings, plus a public read-only API (
mod_playergroup\api\group_info) other plugins can query โ a single studentโs group summary, or badges for several groups in one bulk call. - ๐ฑ Mobile App: Native support in the official Moodle app โ create, join, leave, invite, view members, and manage your group on the go.
๐ Educational Purpose
PlayerGroup is designed to:
- Foster collaborative learning through self-organised teams
- Reduce teacher workload in group formation
- Reward group membership as a gamification milestone
- Integrate naturally into gamified course flows
Suitable for:
- Project-based learning where students choose their own teams
- Labs and workshops with limited seats per group
- Gamified courses using the PlayerHUD ecosystem
- Any context where peer team selection matters
๐น๏ธ PlayerGames Ecosystem
PlayerGroup is part of the PlayerGames gamification ecosystem for Moodle. Together, these plugins transform Moodle into an immersive experience:
-
PlayerHUD Block: The core gamification component โ XP, levels, inventory, ranking, RPG classes, and story engine. Displays the studentโs group as part of their in-game profile via PlayerGroupโs public API.
-
PlayerHUD Filter: Enables item drops via shortcodes inside course content.
-
PlayerHUD Availability Restriction: Restricts access to course activities based on the studentโs current level or collected items.
๐ https://github.com/jeanlucio/moodle-availability_playerhud
See the PlayerGames hub for the full plugin family.
๐ฆ Requirements
| Component | Version |
|---|---|
| Moodle | 4.5+ |
| PHP | 8.1+ |
๐ ๏ธ Installation & Configuration
- Download the
.zipfile or clone this repository. - Extract the folder into your Moodle
mod/directory. - Rename the folder to
playergroup(if necessary). Final path:your-moodle/mod/playergroup/ - Visit Site administration > Notifications to complete installation.
- Add a PlayerGroup activity to any course.
This plugin has no separate site-level settings to configure after installation โ every setting is configured by the teacher when adding the activity to a course, as covered in Usage below.
๐ Usage
- Add a PlayerGroup activity to your course.
- Configure:
- Minimum / maximum members per group
- Grouping mode โ create a new grouping automatically, use an existing one, or none
- Allow students to leave their group, and whether an emptied group is deleted automatically
- Delete groups on activity deletion โ only ever removes groups and a grouping this activity actually created; a pre-existing grouping pointed at via โuse an existing groupingโ is left alone
- Foundation reward โ grade automatically awarded to every student who joins or creates a group
- Students open the activity and create a group (name, description, emoji badge, privacy level) or join an existing one โ open, password-protected, or by accepting an invite.
- From any group card, students can:
- Click the member count to see who is in that group, with the founder marked as leader
- Invite an enrolled colleague who has no group yet (only shown to students who can also see the course participant list)
- Leave their own group, if the teacher allows it
- The activity completes and the grade is awarded automatically the moment a student joins or creates a group.
- Teachers get two report tabs from the activity page: the activity log (who did what, when) and groups and members (a full roster, one row per member) โ both exportable to CSV and Excel.
๐งช Automated Tests
PlayerGroup ships with a PHPUnit suite covering business logic, web services, reports/exports, the renderer and mobile app output, the public API, and Privacy API compliance, plus a Behat suite for browser acceptance. Every CI push runs against the full matrix (Moodle 4.5 โ 5.x, PostgreSQL & MariaDB).
PHPUnit โ By Area
| Area | Files | Cases |
|---|---|---|
Web services (tests/external/) |
8 | 53 |
Core (lib_test.php, grading, completion, locking, member ordering, backup, privacy) |
7 | 36 |
Reports & exports (tests/controller/) |
2 | 5 |
Output & mobile app (tests/output/) |
2 | 14 |
Public API (tests/api/) |
1 | 6 |
| Grand Total | 20 | 114 |
vendor/bin/phpunit --testsuite mod_playergroup
Overall line coverage (moodle-coverage, PHPUnit + Xdebug): 80%.
Behat โ Acceptance Tests
| Feature file | Scenarios |
|---|---|
create_group.feature |
2 |
join_group.feature |
2 |
join_protected_group.feature |
3 |
view.feature |
3 |
invite_colleagues.feature |
1 |
view_members.feature |
1 |
| Total | 12 |
php admin/tool/behat/cli/init.php
vendor/bin/behat --tags=@mod_playergroup --profile=chrome
Full test-by-test breakdown and coverage table โ
๐ Security & Compliance
- Capability-based access control (
mod/playergroup:creategroup,mod/playergroup:view,mod/playergroup:manage,mod/playergroup:manageinvites) - Every group operation is scoped by activity instance โ a group ID or invite ID from another activity, or another course, is always rejected rather than trusted
require_sesskey()protection on all state-changing operations; AJAX calls are validated by Moodleโscore/ajaxdispatcher- Group creation, joining, and invite acceptance are serialised per activity instance through
\core\lock\lock_config, closing a check-then-act race that could otherwise let two concurrent requests place a student in two groups or push a group past its member limit - The invite picker only lists actively enrolled students and is gated by
moodle/course:viewparticipants, so it never becomes an alternate route to participant information a course has deliberately hidden from students - Group passwords are stored with
password_hash()and verified withpassword_verify(); the stored hash is never returned to the client - Deleting the activity only ever removes groups and a grouping it created itself โ never a pre-existing grouping (or its other groups) the teacher pointed the activity at
- Moodle External API compliant
- Full Privacy API implementation โ data export and deletion supported
- Backup and restore support, including safe ID remapping across a course duplication or restore
๐ License
This project is licensed under the GNU General Public License v3 (GPLv3).
Copyright: 2026 Jean Lรบcio