#2519 closed defect (bug) (wontfix)
Process writing of new entries with category exclusions
Reported by: | coppit | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.0.1 |
Component: | Administration | Keywords: | |
Focuses: | Cc: |
Description
I'd like my Category Access plug-in to restrict not only reading entries based on category (which it does) but the writing of entries in restricted categories.
In short, only restricted categories should appear in the list of available categories on the Admin-Write page. To make this happen, the Wordpress function needs to allow exclusions to be applied as shown below (only the *-line is different in the SQL). The 'return' needs to get a column not a result too.
Making this small change allows any plug-in to provide exclusions.
wp-admin\admin-functions.php: line 513
// Original SQL line taken out to be replaced with 'extended' query> below. // Copied and modified from template-functions-category.php line 293, 'list_cats()', // this is the line that calls the "Catagory Access" filter hook, // ensuring that the list is filtered by user access settings $exclusions = apply_filters('list_cats_exclusions', '' ); $query = " SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent *** AND cat_ID > 0 $exclusions ORDER BY cat_ID ASC LIMIT 100"; return $wpdb->get_col($query); // get_results -> get_col
Change History (6)
#5
@
16 years ago
- Resolution set to wontfix
- Status changed from new to closed
I believe that the 'get_terms' filter in get_terms() is what you need to be looking at in the current code. The admin interface and functions may need a tweak to take advantage of it. Due to lack of any recent discussion (especially after categories changed to terms), closing as wontfix. Please reopen if you feel there's a current need for this.
I'm reworking all of the category retrieval code. I'll make sure to include this capability.