Support

Account

Home Forums Add-ons Gallery Field ACF PRO Gallery: restrict view own Media Reply To: ACF PRO Gallery: restrict view own Media

  • Thx John… copy that – you are absolutely right. But why I’m wondering was the fact that the new Post will show the image from another author but not the gallery items.

    we are using the following action to restrict users fro their own media/posts:

     if( is_admin() && !current_user_can('edit_others_posts') ) {
            $wp_query->set( 'author', $current_user->ID )...

    With this function we normale did’t see the ACF groups in a post too.
    so we were using this snippet

    if (isset($wp_query->query_vars['post_type']) && 
        ($wp_query->query_vars['post_type'] == 'acf-field' || 
         $wp_query->query_vars['post_type'] == 'acf-field-group'
        )) { return; }

    and to fix the problem with the Gallery we were adding on more condition:

    if (isset($wp_query->query_vars['post_type']) && 
        ($wp_query->query_vars['post_type'] == 'acf-field' || 
         $wp_query->query_vars['post_type'] == 'acf-field-group' || 
         ($pagenow == 'post.php')
        )) {return; }

    cheers