Top Active Courses

Blocks ::: block_topactivecourses
Maintained by Sadik Mert
The Top Active Courses block is a Moodle plugin that displays a visually appealing list of the most active courses on your Moodle site. It is designed to help users discover popular courses they are not yet enrolled in, but where self-enrolment is possible. The block uses a modern card-based layout with course images, titles, and direct links to the course pages.

Top Active Courses 1.1.0

Moodle 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 5.0
Released: Monday 15 September 2025, 20:24

Top Active Courses Block - Release Notes

🚀 New Features

Mustache Templating

  • Switched to modern templating system: Replaced inline HTML generation with Mustache templates for better maintainability and customization
  • Template-based course tiles: Course tiles are now rendered using templates/course_tiles.mustache

Course Tags Display

  • Tag display per course: Shows up to configurable number of tags under each course title
  • Configurable tag limit: New setting max_tags allows administrators to control how many tags are displayed per course (default: 5)
  • Modern tag design: Tags are displayed as stylish badges with hover effects

Enhanced Enrolment Method Support

  • Flexible enrolment filtering: Improved from hardcoded 'self' enrolment to dynamic can_self_enrol() method checking
  • Ignore enrolment methods option: New setting ignore_enrolment_methods allows showing all active courses regardless of enrolment method
  • Better compatibility: Works with various Moodle enrolment plugins that implement can_self_enrol()

🎨 UI/UX Improvements

Responsive Design

  • Drawer optimization: Course tiles automatically adapt to sidebar/drawer layout
  • Improved CSS specificity: Fixed text decoration issues in various Moodle Themes
  • Modern badge styling: Course tags use consistent design language with other Moodle components

⚙️ New Settings

  1. Max Tags per Course (max_tags)

    • Controls number of tags displayed per course
    • Default: 5 tags
    • Validation: Must be numeric and > 0
  2. Ignore Enrolment Methods (ignore_enrolment_methods)

    • Checkbox to bypass enrolment method filtering
    • Shows all active courses when enabled
    • Useful for open course catalogs

🔧 Code Quality Improvements

Refactoring for Maintainability

  • Reduced cyclomatic complexity: Split complex methods into smaller, focused functions
  • Better separation of concerns: Course data preparation, enrolment checking, and rendering are now separate methods
  • Improved testability: Smaller functions make unit testing easier

New Helper Methods

  • prepare_course_data(): Prepares course data for template rendering
  • can_user_access_course(): Centralized course access checking
  • get_course_image(): Course image retrieval with fallback
  • get_max_tags_limit(): Tag limit configuration helper
  • get_course_tags(): Tag retrieval and limiting
  • should_include_course(): Course inclusion logic
  • can_self_enrol_in_course(): Self-enrolment possibility checking

🐛 Bug Fixes

  • CSS specificity issues: Fixed text-decoration conflicts with core Moodle styles
  • Parameter validation: Improved handling of invalid configuration values

📚 Documentation

  • Enhanced code documentation: All new methods have comprehensive PHPDoc blocks
  • Template documentation: Mustache template includes usage examples and context description

Installation/Upgrade Notes

  1. Clear caches after installation/upgrade
  2. Review new settings in Site Administration → Plugins → Blocks → Top Active Courses
  3. Check custom CSS if you have theme customizations targeting course tiles
  4. Test enrolment filtering with your specific enrolment methods

Author

  • Sadik Mert
    E-Mail: sadikmert@hotmail.de

License

This plugin is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

Version information

Version build number
2025091503
Version release name
1.1.0
Maturity
Bèta
MD5 Sum
e1c46f6c3b1f55439d98ba988238aee6
Supported software
Moodle 4.0, Moodle 4.1, Moodle 4.2, Moodle 4.3, Moodle 4.4, Moodle 4.5, Moodle 5.0
  • Latest release for Moodle 4.0
  • Latest release for Moodle 4.1
  • Latest release for Moodle 4.2
  • Latest release for Moodle 4.3
  • 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)
GIT
VCS repository URL
VCS branch
main

Default installation instructions for plugins of the type Blocks

  1. Make sure you have all the required versions.
  2. Download and unpack the block folder.
  3. Place the folder (eg "myblock") in the "blocks" subdirectory.
  4. Visit http://yoursite.com/admin to complete the installation
  5. Turn editing on in any home or course page.
  6. Add the block to the page
  7. Visit the config link in the block for more options.