Load few static media/images in Media for all instructors with Instructor privacy

1. Create a new Admin user and note the User id . Assuming user is as XX for rest of the tip.

2. Upload the Media (images/audio,video) in WordPress media manager while logged in from that admin user.

3. Add this code in WP admin -> plugins -> editor -> wplms customizer -> wplms_customizer.php

 

add_action('init','add_custom_filters');
function add_custom_filters(){
    remove_filter( 'posts_where', 'wplms_attachments_wpquery_where',10 );
    add_filter( 'posts_where', 'custom_wplms_attachments_wpquery_where',30);
    function custom_wplms_attachments_wpquery_where( $where ){
      $instructor_privacy = vibe_get_option('instructor_content_privacy');
       
        if(isset($instructor_privacy) && $instructor_privacy && !current_user_can('manage_options')){
            
          if( is_user_logged_in() && current_user_can('edit_posts')){
            global $current_user;
            if( isset( $_POST['action'] ) ){
              if( $_POST['action'] == 'query-attachments' ){
                $where .= ' AND post_author IN ('.$current_user->data->ID.',1)';
              }
            }
          }
        }
      return $where;
    }
}