Default Media Set

Home Forums General [ No Support Zone ] Feature Request Default Media Set

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3853
    mesrick
    Spectator
    setup a default media set such that it is owned by an admin (so only the admin can edit it) but every instructor has the ability to duplicate, then edit and insert this media and view it from the media library.
    #3881
    MrVibe
    Keymaster
    I am sure this has been requested more than once. Here's how you can achieve this. Consider user Admin (usually id  1) or any other user. We can create a default media set which would comprise of all the uploaded by this user.
    remove_filter('posts_where', 'wplms_attachments_wpquery_where');
    add_filter( 'posts_where', 'wplms_default_media_set');
    
    function wplms_default_media_set( $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 )'; //1 is the user id of default user for media set
              }
            }
          }
        }
      return $where;
    }
     
    #4539
    mesrick
    Spectator
    Changed all media to the user with the id we are putting into the provided code. Pasted code into customizer. Logged in as an instructor and media library is blank. Please advise
    #14521
    mesrick
    Spectator
    What exactly was the code you provided supposed to accomplish?
    #16763
    H.K. Latiyan
    Participant
    The above code lets all of your instructors use the media uploaded by the admin, so that the instructors don't have to duplicate the media for individual usage. Refer this video: http://screencast-o-matic.com/watch/cDVhlChB0A
    #55472
    mesrick
    Spectator
    Can you please confirm this function still works since the latest updates?
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Default Media Set’ is closed to new replies.