Conversation
…ry to ensure proper compatibility with Tutor LMS when ReadyLaunch is active
The paginate_links_output filter hook is now conditionally loaded to resolve a pagination conflict. Since Tutor LMS ships with its own pagination that operates via AJAX, it is incompatible with ReadyLaunch's pagination implementation. To address this, the ReadyLaunch pagination is excluded only when all of the following conditions are true: - ReadyLaunch is active - Tutor LMS is active - The user is on the member profile page Courses tab or any of its sub-tabs Outside of this specific context, ReadyLaunch pagination continues to function normally across the rest of the website.
|
Thanks for your pull request. It looks like this may be your first contribution to the BuddyBoss Platform open source project. Please note that this project and all contributions to it are public and bounded by the GPL v2.0 license, and that a record of the contribution (including all personal information you submit with it, including your full name and email address) is maintained indefinitely and may be redistributed with this project. If you are not okay with these terms, please close this pull request. Alternatively, you can let us know about your concerns by adding a comment to this pull request. |
|
Claude finished @sajib-bb's task —— View job PR Review CompleteI've thoroughly reviewed the changes in this PR. Here's my comprehensive assessment: Review Checklist
SummaryThis PR adds ReadyLaunch template support for TutorLMS courses and conditionally excludes the pagination filter from course pages to fix pagination issues. The changes are minimal but targeted. Code Quality Assessment✅ Strengths
|
|
Claude finished @sajib-bb's task —— View job PR Review CompleteI've thoroughly reviewed the changes in this PR. Here's my comprehensive assessment: Review Checklist
SummaryThis PR adds ReadyLaunch template support for TutorLMS courses and conditionally excludes the pagination filter from course pages to fix pagination issues. The changes are minimal but targeted. Code Quality Assessment✅ Strengths
|
reza-bb
left a comment
There was a problem hiding this comment.
Please make the necessary changes to meet the requirements.
|
|
||
| add_filter( 'paginate_links_output', array( $this, 'bb_rl_filter_paginate_links_output' ), 10, 2 ); | ||
| // Apply pagination filter to all pages except BuddyBoss user profile's (courses tab or any of its sub-tabs) when Tutor LMS is active. | ||
| if ( ! ( function_exists( 'tutor_utils' ) && bp_is_user() && preg_match( '/courses/i', bp_current_action() ) ) ) { |
There was a problem hiding this comment.
- Avoid using
preg_match, use any alternate for the validation. - Add more validation for
bp_current_action. - Add proper validation for checking if
tutor_lmsis active or not.
|
|
||
| if ( ! empty( $bb_tutorlms_groups['courses'] ) && tutor_utils()->count( $bb_tutorlms_groups['courses'] ) ) { | ||
| $course_ids_string = implode( ',', $bb_tutorlms_groups['courses'] ); | ||
| echo tutor_lms()->shortcode->tutor_course( array( 'id' => $course_ids_string, 'show_pagination' => 'on', 'post_status' => array('publish', 'private') ) ); |
There was a problem hiding this comment.
- Missing output escaping.
- Missing validation.
- Use the long array syntax with a trailing comma.
- This is a generic file that is used for all the LMSs. Making strict changes for only one LMS may make the system fail for other LMSs. Test properly with all the LMSs.
| * | ||
| * @since 2.4.40 | ||
| * | ||
| * @package BuddyBoss\TutorLMS |
There was a problem hiding this comment.
This is a generic course page. TutorLMS cannot be mentioned strictly here.
| * | ||
| * This template can be overridden by copying it to yourtheme/buddypress/groups/single/courses.php. | ||
| * | ||
| * @since 2.4.40 |
There was a problem hiding this comment.
Never use version numbers hardcoded. Use @since [BBVERSION] to add the version number dynamically during the release build process.
| return; | ||
| } | ||
|
|
||
| $bb_tutorlms_groups = bb_load_tutorlms_group()->get( |
There was a problem hiding this comment.
- Missing validation for other LMSs
|
|
||
| // Check if the item is a numeric ID (integer or string representation of an integer). | ||
| $course_ids[] = intval( $course ); | ||
| } elseif ( is_object( $course ) ) { |
| if ( ! empty( $courses_list ) && is_array( $courses_list ) ) { | ||
| foreach ( $courses_list as $course ) { | ||
| if ( is_numeric( $course ) ) { | ||
|
|
|
|
||
| // If the item is an object, you can access its ID property. | ||
| $course_ids[] = $course->ID; | ||
| } |
| $course_ids = array_unique( $course_ids ); | ||
|
|
||
| if ( ! function_exists( 'bb_enable_content_counts' ) || bb_enable_content_counts() ) { | ||
| $count = count( $course_ids ); |
There was a problem hiding this comment.
count is a reserved word for PHP. Use something self-explaining
| <?php | ||
| /* translators: %d is the courses count */ | ||
| printf( | ||
| wp_kses( _n( '<span class="bb-count">%d</span> Course', '<span class="bb-count">%d</span> Courses', $count, 'buddyboss-pro' ), array( 'span' => array( 'class' => true ) ) ), |
Jira Issue:
https://buddyboss.atlassian.net/browse/PROD-9833
General Note
Keep all conversations related to this PR in the associated Jira issue(s). Do NOT add comment on this PR or edit this PR’s description.
Notes to Developer
Notes to Reviewer