Category Exclusion

Description

Category Exclusion lets you exclude categories depending on user role and view.

Each category is assigned a set of properties that lets you control in what places and from whom it should be excluded. Here is a list of describing the properties:

  • Treshold controls which users have access to a post. A post is invisible to the user if it belongs to a category with a higher treshold than the user’s role.
  • Home controls which posts are shown on the main page. Posts belonging to a category with the home property disabled never show up on the main page.
  • Archive controls which posts are shown in the archives – the category archives are not affected by this property. Posts belonging to a category with the archive property disabled never show up in the archives.
  • List controls which categories have a link in the category list (presumably in the sidebar).
  • Search controls which posts are available for search. Posts belonging to a category with the search property disabled never show up in search results.
  • Feed controls which posts are show up on in syndication feeds. Posts belonging to a category with the feed property disabled never show up in syndication feeds.

    NOTE: The permissions mechanism in WordPress 2.0 is not a pure role system but a role/level hybrid. For instance all default roles are subsets of eachother. I utilize this fact in order to simplify the plugin.

    History

    Category Exclusion is a fork of Ryan Poe’s no longer maintained Elegant Category (In)Visibility.

    Changelog:
    2006-01-15, Version 0.2

  • Compatible with PHP 4.1.1 (not tested with earlier versions)

    2006-01-11, Version 0.1

  • added a treshold restriction I borrowed from Keith McDuffee’s Category Visibility
  • hiding of links from the category list (in the sidebar), either explicitly with the “list” property, or implicitly by the “treshold” restriction
  • “author” and “date” properties are combined into the new “archive” property

    Known problems

  • Previous and next links in the single post view are note filtered. This is not yet allowed by WordPress.
  • This plugin may cause dead links to chronological archives if all posts have too high tresholds for the user. Fixing this requires new hooks in WordPress.

    Download

    Category Exclusion 0.2 (for WordPress 2.0)
    Category Exclusion 0.1 (for WordPress 2.0)

19 kommentarer till “Category Exclusion”

  1. Thomas Says:

    I just tried to use the plug-in on WP2.0 and recieved this error upon activating it:

    Parse error: parse error, unexpected ’&’, expecting T_VARIABLE or ’$’ in /home/mysite/public_html/blog/wp-content/plugins/cat-exclusion-0.1.php on line 174

  2. Mattias Says:

    Oh.
    What version of PHP are you running?
    Does it work if you manually remove the & in line 174?

  3. Thomas Says:

    Perfect solution. I’m running PHP Version 4.4.1. Thanks for this plugin.

    Did you integrate all of your fixes from the original posting here? http://tova.fena.se/2005/06/11/category-visibility/

    I realized that a lot of the problems you patched were issues that I was having with the original category visibility plugin. I actually found your site via Google when searching for solutions so I’m interested in your thoughts. Thanks.

  4. Mattias Says:

    Great! I’ll make an update.

    My thoughts? Well. I’m basically just trying to improve on the Category Visibility plugin. My reasons for forking were that Keith hadn’t updated his plugin in a long time, WordPress 2.0 compatibility required rewriting of the User Level code anyway, and I got to work on a nicer code base.
    My focus is bug fixing and polish, and getting those last hooks in so I don’t have to distribute patches for WordPress itself.

    Yes, I checked the changelog from the original posting to make sure this plugin has none of those problems. The “Other patches” section is not integrated because WordPress still lacks hooks in those places. Those patches aren’t ported yet either.

  5. Thomas Says:

    Okay that’s great. I’m looking forward to getting your “other patches” stuff in there including the “permission denied” stuff. Let us know when you update the plugin for that.

  6. Thomas Says:

    Is there any way to change the default database select that many plugins use and add a switch to keep posts with invisibility turned on to not be returned? For example, password protected posts can be easily filtered, can we do the same with invisibility?

  7. steadyvibe Says:

    When the plugin is activated, and i turn off certain categories from the archives it still displays the months where the certain categories are but then when the months are clicked on it says the page you are looking for is not there. Is there a way to make the month not be displayed if the category is turned off?

  8. Pavel Oreski Says:

    If I activate plugin and unselect certain categories from “Home” i loose not only post of that categories from main page, but also those categories disapier from list of categories in the sidebar. I run Wordpress 2.0.1.

    It may be my problem, because i tried the plugin which this one is based on and it work just the same way.

    May be the problem that i have some posts in more than one category. My aim is that sometimes i want post from certain category to be displayed on main page but sometimes not, which i would achiev by post being in more than one category.

  9. Biblio Says:

    Thank You! This is exatly what I needed!

  10. Daniel Says:

    Small bug

    My site loads from left to right, meaning posts on the left and sidebar on the right.

    When I exclude a category from the home page, it also removes it from my category “list” that is on the right in my sidebar. Setting the category hidden in the “list” does correctly work and not remove the posts however.

  11. Bert-Jan Says:

    If I activate plugin and unselect certain categories from “Home” i loose not only post of that categories from main page, but also those categories disapier from list of categories in the sidebar. I run Wordpress 2.0.1.

    >> I have the same problem and I’m using WordPress 2.0.2

    I hope you could fix this great plugin!!!

  12. bit-blog » Blog Archive » wordpress pluginok Says:

    [...] Category Exclusion: egyes bejegyzések nem jelennek meg a főoldalon, az archívumban, a rss nyalábban, stb. http://tova.fena.se/2006/01/11/category-exclusion/ [...]

  13. kishmish Says:

    Nice stuff.
    installed and run with no problem. however, I had an extra wish; I would like to exclude posts from certain categories being shown on index page (this is accomplished by this plug-in) but I would like to display these “index page excluded” posts being shown when going to that category. or something like that.

    any idea how to do this?

    or any other way of doing this?

    thanks in advance.

  14. Johan Says:

    I presume that even if the cat is excluded from the general feed, its own category feed still works, right?

  15. Johan Says:

    Hm, here’s a strange error I get on the main page, after having created a cat to be excluded from Main, Feed, and List. This occurs where I’d expect the list to appear:

    WordPress database error: [Not unique table/alias: ‘wp_post2cat’]
    SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND (category_id != 7) AND post_date_gmt

  16. Halomem Says:

    If I remove a category from mainpage, it also been removed from the sidebar list on the homepage, however I want them to view them in the sidebar list at the mainpage but i don’t want them to view at page. How can I solve this prob?

  17. David Silverthorn Says:

    Hey there, I updated your plugin to work with WordpressMU 1.0 (as in 0.2 state, the plugin will only adjust the root domain settings).

    replace line 203 with

    ?page=” method=”post”>

    As you can see, all I added was get_bloginfo(‘url’) with the comma

    I’m not certain what this will do to the regular WP, but it allows the plugin to work perfectly with WPMU.

  18. David Silverthorn Says:

    oops, didn’t come out too well…

    I added the get_bloginfo(‘url’) before $_SERVER[PHP SELF]

  19. blogotronic Says:

    first of all thanks for this great plugin! nonetheless i have a problem with it: if i remove a category from the index page, there are some posts (of other categories) shown twice. any ideas?

Kommentera