Lock Grades

Local plugins ::: local_lockgrades
Maintained by Miguël Dhyne
Moodle plugin that allows administrators to recursively lock or unlock a grade category (grade items) along with all its subcategories and associated items, using an idnumber field as the identifier.

Lock Grades 1.6 (Build 2025070800)

Moodle 4.2, 4.4, 4.5, 5.0
Released: Thursday, 31 July 2025, 11:42 PM

Release Notes — Lock Grades (local_lockgrades)

Overview

Lock Grades is a Moodle plugin that enables administrators to recursively lock or unlock a grade category (including all its subcategories and items) using the idnumber field as an identifier. The plugin also allows filtering by course shortname and offers advanced scheduling and management features.


New in This Release

  • Action Scheduling: Schedule locking or unlocking for a specific date and time. Actions are executed automatically by Moodle’s cron.
  • Dry-run Preview: Preview the list of courses that would be affected before applying or scheduling an action.
  • Advanced Task Management: View, edit, duplicate, or delete scheduled actions in a unified table before execution.
  • Ancestral Lock Inheritance: New grade items or categories automatically inherit the locked status if any ancestor category is locked.
  • Unified Action History: All actions (immediate or scheduled) are shown in a single sortable, filterable table with expandable details.
  • Enhanced Security: Access restricted to users with the local/lockgrades:manage capability.

Key Features

  • Recursive Lock/Unlock: Automatically updates the locked status of all child grade items and subcategories, using database transactions for data integrity.
  • Course Filtering: Optionally limit actions to courses whose shortname contains a specific substring.
  • Unlock Constraints: A subcategory cannot be unlocked if any of its ancestor categories remains locked.
  • Simple Interface: Admin form for entering the category idnumber, optional course filter, selecting the date/time, and choosing the action (lock, unlock, schedule, preview).
  • Detailed Logging: All actions (executed or scheduled) are recorded, with status, filters, dates, and affected items visible.
  • Transactional Integrity: All changes use database transactions to guarantee consistency.

Requirements

  • Moodle 4.2 or higher
  • SSH or FTP access to copy files to the server
  • Administrator rights on the Moodle platform

Installation

  1. Copy the files: Place the lockgrades folder inside the local/ directory of your Moodle installation.

  2. Check permissions: Ensure the files and folders are readable by the web server user (usually www-data).

  3. Database update: Log in as a Moodle administrator. Moodle will detect the new plugin and prompt you to update the database.

  4. Verification: Go to Site administration > Plugins > Local plugins to check that Lock Grades appears in the list.


Usage

  1. Log in with a user account that has the local/lockgrades:manage capability.
  2. Go to /local/lockgrades/index.php on your Moodle site.
  3. Enter the category ID number of the grade item to (un)lock (e.g., totPeriode_1).
  4. Optionally, enter a course shortname filter (leave blank to affect all courses).
  5. Use the Preview button to see which courses would be affected before proceeding.
  6. To lock or unlock immediately, click Lock grades or Unlock grades.
  7. To schedule a lock or unlock, select the desired date and time, then click Schedule Lock or Schedule Unlock. Actions will be executed by Moodle’s cron.
  8. Review and manage all scheduled actions at the bottom of the page. You can edit, duplicate, or delete any pending task before execution.
  9. After each action, a confirmation and an informational message will be displayed.

Customization

  • Adjust capabilities: To restrict access to other roles, modify the capability requirement in the plugin code and adjust access.php.
  • Edit messages: Modify language strings in lang/en/local_lockgrades.php or lang/fr/local_lockgrades.php.
  • Default behavior: The course filter is optional. If left blank, actions affect all courses containing the matching idnumber.

License

This plugin is distributed under the GNU GPL v3 license. See the LICENSE file for details.


Author and Support

For questions or contributions, please open an issue or submit a pull request on the project’s GitHub repository.

Version information

Version build number
2025070800
Version release name
1.6 (Build 2025070800)
Maturity
Stable version
MD5 Sum
007b375ccf472b1f63b6397a988cbe6a
Supported software
Moodle 4.2, Moodle 4.4, Moodle 4.5, Moodle 5.0
  • Latest release for Moodle 4.2
  • Latest release for Moodle 4.4
  • Latest release for Moodle 4.5
  • Latest release for Moodle 5.0

Version control information

Version control system (VCS)
Other...
VCS repository URL

Default installation instructions for plugins of the type Local plugins

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder in the "local" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation.