Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing broken prepare statement breaking LifterLMS enrollments #3286

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions includes/compatibility/lifterlms.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,19 @@ function pmpro_lifter_get_courses_for_levels( $level_ids ) {
return array();
}

$level_placeholders = implode(',', array_fill(0, count($level_ids), '%d'));
$course_ids = $wpdb->get_col(
$wpdb->prepare(
"
SELECT mp.page_id
FROM $wpdb->pmpro_memberships_pages mp
LEFT JOIN $wpdb->posts p ON mp.page_id = p.ID
WHERE mp.membership_id IN(%s)
WHERE mp.membership_id IN($level_placeholders)
AND p.post_type = 'course'
AND p.post_status = 'publish'
GROUP BY mp.page_id
",
implode(',', $level_ids )
...$level_ids
)
);

Expand Down