Skip to content

PROD-9961: Fix Courses nav link when TutorLMS has a custom course permalink slug - #5048

Open
rezwan-buddyboss wants to merge 1 commit into
releasefrom
PROD-9961
Open

PROD-9961: Fix Courses nav link when TutorLMS has a custom course permalink slug#5048
rezwan-buddyboss wants to merge 1 commit into
releasefrom
PROD-9961

Conversation

@rezwan-buddyboss

@rezwan-buddyboss rezwan-buddyboss commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

PROD link: https://buddyboss.atlassian.net/browse/PROD-9961

Issue

On a site running ReadyLaunch with TutorLMS, when a custom course permalink slug is configured in TutorLMS's own settings, the "Courses" link in the ReadyLaunch sidebar/menu has no URL. Clicking it does nothing — the page doesn't navigate anywhere, because the link's href is empty. With TutorLMS's default courses slug, the link works fine; the bug only surfaces once that slug is changed.

Root cause

class-bb-readylaunch.php:710 built the Courses nav link with get_post_type_archive_link( bb_tutorlms_profile_courses_slug() ). get_post_type_archive_link() expects the registered post type name as its argument, but bb_tutorlms_profile_courses_slug() returns TutorLMS's course_permalink_base option — the post type's rewrite slug, which is a separate, independently-configurable value. The two happen to be identical (courses) under TutorLMS's defaults, which is why the bug is invisible until an admin changes the permalink setting. Once they diverge, get_post_type_archive_link() can't match the passed string to any registered post type and returns an empty string, leaving the nav item with no URL.

The sibling elseif branch two lines down, for MemberPress Courses, already does this correctly — it passes memberpress\courses\models\Course::$cpt, the actual registered CPT constant, not a slug.

Fix

Changed the argument to tutor()->course_post_type — TutorLMS's own registered CPT name, confirmed against TutorLMS's Post_types.php registration code. This CPT name is fixed regardless of how the permalink slug is configured, so get_post_type_archive_link() resolves correctly either way, matching the same pattern the MemberPress branch already uses.

get_post_type_archive_link() expects the registered post type name,
but bb_tutorlms_profile_courses_slug() returns TutorLMS's
course_permalink_base option, which can be customized independently
of the post type. When a custom slug is set, the two no longer match
and the archive link resolves to empty. Use tutor()->course_post_type
directly instead.
@rezwan-buddyboss rezwan-buddyboss changed the title Fix Courses nav link when TutorLMS has a custom course permalink slug PROD-9961: Fix Courses nav link when TutorLMS has a custom course permalink slug Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant