Skip to content

Instantly share code, notes, and snippets.

@marktenney
Created January 18, 2021 20:18
Show Gist options
  • Save marktenney/4b1919cca186bcfd751cf78d725102ae to your computer and use it in GitHub Desktop.
Save marktenney/4b1919cca186bcfd751cf78d725102ae to your computer and use it in GitHub Desktop.
Filter Beaver Builder Posts Module to Display User Enrolled Courses
<?php
function fl_builder_loop_query_args_filter( $query_args ) {
$current_user = get_user_by( 'id', $atts['user_id'] );
$user_courses = ld_get_mycourses( $atts['user_id'], $atts );
if ( 'enrolled-courses' == $query_args['settings']->id ) {
$query_args['id'] = $user_courses;
}
return $query_args;
}
add_filter( 'fl_builder_loop_query_args', 'fl_builder_loop_query_args_filter' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment