Moodle is one of the most powerful open-source learning management systems (LMS) in the world, but like any complex platform, it isn’t immune to bugs. One such issue that has frustrated course creators and educators alike is the Moodle activity completion bug, where quiz activities marked as “complete on passing grade” incorrectly unlock subsequent content even when the student fails the quiz.
This problem isn’t just an inconvenience—it can break the learning flow of your course and reduce the effectiveness of conditional access, which is critical for competency-based learning.
In this blog post, we’ll dive into:
- What causes this Moodle quiz completion bug
- How to reproduce and identify the problem
- Step-by-step instructions to fix it
- How Infranext can help you maintain a bug-free Moodle environment
What’s the Problem?
Educators using conditional activities in Moodle often rely on “Activity Completion” rules to ensure that students unlock the next section only after achieving a specific grade.
The issue arises when:
- A quiz activity is set with the condition “Must achieve a passing grade to be marked complete.”
- A follow-up activity is locked until the quiz is marked complete.
- Students fail the quiz, yet the next activity still unlocks—bypassing the intended restriction.
This bug has been reported across Moodle 4.0.x – 4.2.x and is referenced in the Moodle Tracker under several IDs (MDL‑76079, MDL‑79367, MDL‑75572).
Why Is This Bug Critical?
- Breaks conditional access: Students can access content without actually meeting prerequisites.
- Reduces assessment integrity: Passing-grade-based progress loses meaning.
- Impacts course flow: Designed pathways for learners fail to work as intended.
Reproducing the Bug
To see the issue in action:
- Create a quiz in Moodle.
- Set Activity Completion → “Require passing grade.”
- Create a second activity (e.g., a lesson) and set Restrict Access → “Must complete the quiz.”
- Enroll a test student and attempt the quiz but fail.
You’ll notice the next activity becomes accessible despite the failure.
The Fix: Step-by-Step Solution
The root cause lies in how Moodle processes completion flags after a quiz submission. It incorrectly evaluates the completion status when multiple completion criteria (viewing, submission, passing) are combined.
Here’s how to fix it:
- Locate the Completion Logic
- Navigate to: swiftCopyEdit
/mod/quiz/classes/completion.php /lib/completionlib.php
- Identify the logic for
get_completion_state()
that processes quiz attempts.
- Navigate to: swiftCopyEdit
- Adjust the Completion Check
Modify the check so that completion is only set to TRUE if the passing grade condition is actually met. phpCopyEditif ($quiz->completionpass && !$attempt->passed) { return COMPLETION_INCOMPLETE; } return COMPLETION_COMPLETE;
- Add Unit Tests
- Write automated tests to verify both passing and failing scenarios.
- Place them in
/mod/quiz/tests/
.
- Purge Caches & Test
- Purge Moodle caches: bashCopyEdit
php admin/cli/purge_caches.php
- Retest using multiple attempts (pass/fail) to ensure correct behavior.
- Purge Moodle caches: bashCopyEdit
- Deploy & Monitor
- If running on production, apply the patch in a staging environment first.
- Monitor quiz completion logs to ensure no unintended regressions.
Why Let Infranext Handle It?
At Infranext, we specialize in custom Moodle development, debugging, and LMS optimization. Instead of manually digging through PHP code, let our expert developers:
- Fix this bug in your LMS safely
- Maintain your Moodle instance for peak performance
- Ensure compatibility with plugins, themes, and updates
Final Thoughts
This Moodle activity completion bug may seem small, but it can derail the entire structure of a course. Fortunately, with a precise fix to Moodle’s completion logic, you can restore the integrity of conditional learning paths.
If you’re struggling with Moodle bugs, performance issues, or need expert LMS customization, contact Infranext today. We’ll help you build a flawless, scalable, and engaging e-learning experience.
Leave a Reply