Skip to content Skip to main menu Skip to utility menu

Reply To: Document Finder Template Problems

Home Forums GovIntranetters Document Finder Template Problems Reply To: Document Finder Template Problems

#3032

Nick Peterson
Participant

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