Ensure every user completes their profile before accessing the platform. Regex validation, event logging, admin dashboard, form enhancement, and completion tracking.
Everything you need to enforce profile completion on your Moodle site.
Moodle doesn't natively support a "complete your profile" gate for custom fields.
Often with only name, email, and password — missing important custom fields like tax code or profession.
Making fields required prevents admins from creating accounts without that data. A catch-22.
Without enforcement, users never fill in their profile. Data stays incomplete forever.
A seamless two-step flow: admin creates, user completes.
The plugin hooks into Moodle's after_require_login callback, which fires on every protected page load. Users cannot bypass the check by navigating directly to any URL.
Two ways to install — pick your favorite.
Download the latest .zip from GitHub Releases and extract into local/forceprofile/.
Everything is managed from the admin settings panel.
| Setting | Description | Default |
|---|---|---|
| Enable | Activate or deactivate the plugin | Disabled |
| Fields to check | Custom profile field shortnames, one per line | (empty) |
| Validation patterns | Optional regex per field: shortname:/pattern/ | (empty) |
| Message | Warning message shown on redirect | "You must complete your profile…" |
| Redirect URL | Local path for profile completion | /user/edit.php |
Optionally enforce a format for specific fields using regex. One pattern per line:
Fields without a pattern only need to be non-empty. Fields with a pattern must match the regex. Invalid patterns are silently skipped.
Monitor profile completion across your entire user base.
Total users, incomplete profiles, and complete profiles at a glance with colored badges.
Username, full name, email, missing fields as badges, and last access date.
Direct links to view and edit each user's profile. Pagination for large sites.
Navigate to Site administration → Plugins → Local plugins → Profile Completion Status. Requires local/forceprofile:viewstatus capability.
Smart UX improvements on the profile edit page — no theme modifications needed.
A red exclamation icon is automatically injected next to each configured field label, making it immediately obvious which fields must be filled.
Dropdown menus (<select>) for incomplete fields get an empty "Scegli..." option prepended, forcing users to make an explicit choice instead of accidentally submitting the first option.
Works automatically on /user/edit.php and /user/editadvanced.php. Uses Moodle's AMD module system — no theme hacks, no custom CSS.
before_standard_html_head callback loads an AMD module (formenhancer.js) that enhances the form client-side. It receives the list of configured fields and which ones are incomplete, then injects the indicators and empty options via DOM manipulation.
Full audit trail in Moodle's standard log system.
| Event | When | Data |
|---|---|---|
profile_blocked |
User is redirected to complete profile | User ID, list of incomplete fields |
profile_completed |
User fills in all required fields | User ID, completion record ID |
When a user completes all fields, a timestamp is recorded in local_forceprofile_compl. This data can be queried for reports or exported via the Moodle privacy API.
Fine-grained access control for exemptions and dashboard access.
| Capability | Description | Default Roles |
|---|---|---|
local/forceprofile:exempt | Exempt from forced profile completion | Manager, Editing Teacher |
local/forceprofile:viewstatus | Access the status dashboard | Manager |
Site administrators are always exempt. Assign capabilities to additional roles via Site administration → Users → Permissions → Define roles.
Security, performance, and architecture.
Once complete, cached in $SESSION. Zero DB queries for the rest of the session.
Parameterized queries via Moodle's $DB API. No raw SQL anywhere.
All messages sanitized via format_string() before rendering.
Redirect URL validated as PARAM_LOCALURL. External URLs rejected.
Non-existent fields and invalid patterns are skipped with debug notices. No loops.
17 tests covering fields, validation, events, completion, and edge cases.
| Path | Reason |
|---|---|
/user/edit.php | Profile edit (where users fill in fields) |
/user/editadvanced.php | Advanced profile edit |
/login/logout.php | Users must always be able to log out |
/login/change_password.php | Password change flow |
/lib/ajax/service.php | AJAX web services |
/lib/ajax/service-nologin.php | AJAX (no login) |
All notable changes to this project.
❗) next to configured field labels on profile edit page<select> fields that are incompleteformenhancer.js using Moodle's module systembefore_standard_html_head to inject JS only on edit pagesprofile_blocked and profile_completed events in Moodle logslocal_forceprofile_compl tablelocal/forceprofile:viewstatusPARAM_LOCALURL) — prevents open redirectformat_string()$PAGE->url access wrapped in try/catch for early page lifecycle safetystrposnull_provider)after_require_login callback for profile enforcementlocal/forceprofile:exempt for managers and editing teachers