Make WordPress Core

Opened 18 years ago

Closed 16 years ago

Last modified 16 years ago

#2519 closed defect (bug) (wontfix)

Process writing of new entries with category exclusions

Reported by: coppit's profile 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)

#1 @ryan
18 years ago

  • Milestone set to 2.1
  • Version changed from 1.5 to 2.0.1

I'm reworking all of the category retrieval code. I'll make sure to include this capability.

#2 @matt
17 years ago

  • Milestone changed from 2.1 to 2.2

#3 @foolswisdom
17 years ago

  • Milestone changed from 2.2 to 2.3

#4 @ryan
17 years ago

  • Milestone changed from 2.3 to 2.4

#5 @pishmishy
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.

#6 @santosj
16 years ago

  • Milestone 2.4 deleted
Note: See TracTickets for help on using tickets.