Document Finder Template Problems
Home › Forums › GovIntranetters › Document Finder Template Problems
Tagged: document finder
- This topic has 3 replies, 2 voices, and was last updated 7 years, 8 months ago by Nick Peterson.
-
AuthorPosts
-
-
31 Mar 2017 at 17:41 #2996Nick PetersonParticipant
Hi All,
We have been using the Document Finder template as a place to store a small subset of files for staff. It had been working well until a recent upgrade where we began to notice that all uploaded files (say from a user blog post) began showing up in the finder. It appears that all files in WP assigned a category (even “Uncategorized”) are appearing in the finder. If we set an unwanted file’s category to “-” or null, it removes it. However this is a manual process and we would like the ability to restrict it to only display certain categories that we choose to prevent it filling up with these un-authorized files. Does anyone know how to do to this? We are on v4.34.
Best,
Nick
-
31 Mar 2017 at 17:50 #2997jaylopezParticipant
Hi Nick. I had the same problem with all the images in the Media Library showing up in the Document Finder. As you discover, if they associated with a Category they show up. We had to go one by one and remove the General category from all of them so that they stopped showing in the results.
-
4 Apr 2017 at 18:22 #3008Nick PetersonParticipant
Thanks Jay,
We’ve noticed this too but are trying to avoid the manual process of un-categorizing everything that is uploaded. We would like a way to limit only certain vetted files to appear within the doc finder but also allow for users to upload files as part of their blog posts without those files showing up in the finder automatically.
Has anyone out there found a way to do this easily?
Best,
Nick
-
6 Apr 2017 at 23:48 #3032Nick PetersonParticipant
Update on this: I was able to get a temporary fix in place to limit media categories to our choosing. The ht-media-atoz plugin calls a main theme function get_terms_by_media_type (line 1201) which contains the actual SQL that returns the category list. I did a simple change to the SQL to only display category IDs we wanted to see:
I changed:
$query = “SELECT t.*, COUNT(*) as total from $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN $wpdb->term_relationships AS r ON r.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN $wpdb->posts AS p ON p.ID = r.object_id WHERE p.post_status = ‘inherit’ AND p.post_type IN(‘”.join( “‘, ‘”, $post_types ).”‘) AND tt.taxonomy IN(‘”.join( “‘, ‘”, $taxonomies ).”‘) GROUP BY t.term_id order by t.slug”;
to:
$query = “SELECT t.*, COUNT(*) as total from $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN $wpdb->term_relationships AS r ON r.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN $wpdb->posts AS p ON p.ID = r.object_id WHERE p.post_status = ‘inherit’ AND p.post_type IN(‘”.join( “‘, ‘”, $post_types ).”‘) AND tt.taxonomy IN(‘”.join( “‘, ‘”, $taxonomies ).”‘) AND tt.term_id IN ([ID1],[ID2],[ID3]) GROUP BY t.term_id order by t.slug”;
Not an ideal perm fix but is helping to hide media items uploaded by our end users from showing up in the doc finder. What would be an ideal fix would be an update to the plugin which allows the admin to choose categories form the backend UI but I didn’t have the time to dig into what that would involve.
Hope this helps someone.
Best,
Nick
-
-
AuthorPosts
- You must be logged in to reply to this topic.