Filtering Media Manager Toolbar Controls and Items Displayed
-
This new question deserves its own topic, so I am starting one in response to these posts in other support topics:
—————————————-
Posted on: Tuesday, May 26, 2015 9:07 AM
Subject: Lacy on “[Plugin: Media Library Assistant] How to exclude a category from media libary.”Hey Guys,
I have a category of Image bank which shouldn’t be shown to a specific user group. Could you point us in the right direction as to where we can filter the default loaded images not to included this category.
** I have already removed this category from the dropdown filter for this user group. Just need to exclude from the featured image media popup.
Many Thanks!
Katie——————————————
Posted on: Wednesday, May 27, 2015 4:22 AM
Subject: Lacy on “[Plugin: Media Library Assistant] Filter media in popup on load”
Hey guys,
Please can you help me I would like to include a search for not in term. So I have one term id of 77 within “attachment_category” and if a user is in a group with no access to this category I wish to remove the images from the media modal popup.
Please see my code ….
$terms = get_terms( 'attachment_category' ); if (current_user_can('administrator') || current_user_can('sales_marketing')) : $hasAccess = true; else : $hasAccess = false; endif; if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ $termID = array(); $imageBank = get_term_by('name', 'Image Bank', 'attachment_category'); $imageBankId = $imageBank->term_id; foreach ( $terms as $term ) { $termID[$term->term_id] = $term->term_id; } if (!$hasAccess) : unset($termID[$imageBankId]); endif; $termID = implode(',' , $termID); } $initial_values['filterTerm'] = $termID; // This would be a not in if poss. return $initial_values;
——————————————
First, I want to be sure I understand the question and the application goal. You wrote “exclude from the featured image media popup” and “remove the images from the media modal popup“. I understand that to mean you want to exclude all Media Library items (images) from the set that appears in the “thumbnails” area of the Media Manager Modal (popup) Window (MMMW); is that right?
You wrote “I have already removed this category from the dropdown filter“. Is that the dropdown control in the toolbar on the MMMW, or another control? Is the code sample you posted related to this comment, or is it part of a proposed solution?
Is it accurate to re-state your goal as “In the MMMW, I want to remove a term from the from the list in the dropdown control on the toolbar and I want to exclude all items assigned to that term from the set presented in the thumbnails area on the window”?
Do you need to exclude the term from the list in the taxonomy meta box in the “ATTACHMENT DETAILS” pane of the MMMW?
Do you need to exclude the term or the items from the Media/Assistant submenu table?
If my restatement of the goal is correct, I believe the solution will require some new MLA hooks to allow the term list and the set of items returned to the MMMW. The existing
mla_media_modal_initial_filters
filter allows you to set the initial “selected value” for the controls but it does not allow the lists in the dropdown controls to be modified.If you can confirm my understanding and answer the above questions I will investigate the work required to enhance MLA to support your requirements. Thanks for any additional information you can provide.
https://www.ads-software.com/plugins/media-library-assistant/
- The topic ‘Filtering Media Manager Toolbar Controls and Items Displayed’ is closed to new replies.