Skip to main content

Lesson unlock bug

I found that the lessons would not unlock in order...

Bug Location: FluentCommunityPro\App\Hooks\Handlers\SequentialLessonLockHandler::getOrderedLessonIds()

Problem: The query fetching all course lessons only orders by priority (->orderBy('priority', 'ASC')). Because lessons across different sections share the same default priority (e.g., 0), the database sort is unstable and returns lessons in an arbitrary order, mismatching the frontend display order.

Fix: Add a secondary sort by ID to the query so it matches the frontend:

php

$rows = CourseLesson::where('space_id', $courseId)

->where('status', 'published')

->orderBy('priority', 'ASC')

->orderBy('id', 'ASC') // <--- Add this line

->get(['id', 'parent_id']);

Shahjahan Jewel

Noted. Tagging Raiyan Marzan 

Raiyan Marzan

Paul Hopkins Fixed in dev. Thanks for the detailed report.

Paul Hopkins

Can’t thank you guys enough for this plugin. It’s transformed what I do.