Allow Categories

Ok, latest wordpress plugin modification. This time its of L. Fargue’s Restrict categories plugin.

  • Users are assigned permissions to view posts in certain categories
  • If users don’t have permission to certain posts, those posts aren’t shown, including in the main view and archives.
  • Categories can be made public to everyone, and there is an option to force users to login.
  • This is an initial version, so please report any errors or bugs.

Installation:
1) Download the plugin: http://wordpress.org/extend/plugins/allow-categories/
2) Unzip it
3) Copy to your wp-content/plugins directory
4) Activate within wordpress admin
5) Goto Managed->Allow Categories to edit permissions

Change Log:
0.6.4
Removed debug statement
0.6.3
Fix for recent posts
0.6.2
Remove debug statement
0.6.1
Added allow_list_categories($args) function that can be used in templates to replace wp_list_categories($args) functions. This is a work around until wordpress provide a proper hook for filter a list of categories, so its not perfect. It may work in place of some wp_list_cats() and list_cats() too.
0.6.0
Fix for (Public) posts and redirect to login
Admin users no longer show up in list for version 2.5+
0.5.9
Option to redirect to login if viewing a post or category that is not public and the user is not already logged in
0.5.8
Small bug fix to comment logic in 0.5.6
0.5.7
Allows editing of draft posts by non-admin owner of the draft.
0.5.6
Shows comment content for RSS for public posts or for RSS readers that
know that share login information with the browser (eg. Opera).
0.5.5
Bug fix that would show posts to users who had no categories listed.

Disclaimer:
This plugin is experimental and is provided with no support or warranty. It should not be considered as providing complete security to wordpress content.


Reader Comments

  1. Blocks the selcted category fine, but when i go directly to a page, this appears on the top left of page “Array ( [0] => 8 [1] => 9 [2] => 1 )” in both firefox and IE while completely reassembling the page in IE.

    Hope this is clear and that you can help?

    Ethan

  2. In answer to Ethan, we had the same problem and
    solved it by commenting out lines 333-334 in
    allowcat.php:

    // print_r($catUser);
    // print_r($cats);

    Why are these two print_r statements here?
    Possibly for debugging?

  3. Hi James,

    thanks for the plugin. That’s exactly what I’m looking for.

    But now, I have a problem, I’m working on a site and I use a static page as front page, and I need to allow some users to access some categories. When I activate the plugin and refresh the main page, show me the message I use for no logged in users, not the info of the main page, can you help me?

    When I desactivate the plugin, the info on the main page is normal.

    Thanks!!

  4. James,

    I fix my error, but now, I check the permission to allow a user go inside a category and login with that user, but if I write another category in the browser url, the user can see that category even if the user don’t have that permission.

    thanks!!

  5. Is this plugin still under development and will it work with WP 2.7.1 without a glitch?

    Thanks,
    Gene

  6. I haven’t got round to try things on 2.7.1

    The plugin is still under developement, but there are just other priorities for me right now. Sorry!

  7. Hi–great plugin, but the category name still appears in the category list even if not logged in as the permitted user. Does your plugin have an option to manipulate the list so that when the permitted user is not logged in the respective category name does not appear. If there is no capability here to that effect, do you know how this can be configured (other plugin or code?).

    Thks very much

    sam

  8. In your templates you can use the function:
    allow_list_categories($args)
    To replace:
    wp_list_categories($args)

    As wordpress doesn’t have a hook for intercepting the listing of categories.

  9. Hi. Thanks for this great plugin. I’m using WordPress MU. I’ve installed the plugin, but when I check five categories to be allowed (on a user with role as editor) and I log in as this user, I can still see all of the categories in the list.

    Please can you advise?

    Thanks very much.
    Adam

  10. hi james, thank you for your plugin. but it seems like conflict with the plugin “theme my login”. Once i deactivate the “AC”, “TML” has no problem at all. Please advise.

  11. hi james, i plan to set up a website with your plugin “allow categories”. but it need to change a bit of your plugin. coz i will create more than hundred categories, so in this case, the “allow categories” admin panel will not so friendly with your current admin layout.(i tried before). so do u available to develop it? i plan to donate USD50.00. please email me for further discussion. thx.

  12. Hi James, I just installed your plugin but have a problem which, I think, has been mentioned in an earlier comment: I am allowing a category only to logged in users and it hides the posts but the comments to the hidden posts are still visible for everyone. Could I be doing something wrong?

    Thanks!

  13. Hi, James,

    First, thank you for this great plugin! I think it is very useful.

    Just want to bring to your attention that it currently does not work with sticky posts. I.e. Sticky posts are displayed regardless of its in a category not permitted to the public.

    Hope you can look into it when you get a chance.
    Thanks!

  14. Does this plugin work with wordpress 2.8.x
    I don’t see anything being added to the admin panel after activating.

  15. Hey,

    your plugin is really great, I am using it for an university project.

    Though I have got one problem. I gave all users the permission to view certain categories. If a user has the right to read the posts in category A, and he should not be able to read in category B (that works quite well) he can write in that category. Is there a possibility that those users can only see the categories they should be able to write into in the editing screen?

    Thanks in advance!
    Jan

  16. Hello,
    Your plugging for WordPress: Allow Categories
    will be you it updated for the version 2.8.6?

    Otherwise how to render compatible it?

    Thank you

  17. Hi James

    Let’s say I allocate a specific category to a specific user. Is it possible that only this user can see the category in the category widget?

    Thanks
    Timit

  18. Hello,
    If you select one authorized category and after you select another prohibed category, the post is published on all selected category !

    ab

  19. Great plugin, so simple and easy to use compared to others I experimented with to do what yours did in an instant.

    Hope you keep updating it.

    Leigh

  20. I just wanted to let you know that v0.6.4 of Allow Categories is having some issues with WP 2.9.2.

    I was receiving intermittent 404 errors throughout my site. After several hours of troubleshooting with tech support we discovered it was related to a plugin. It ended up being Allow Categories.

    Worked fine in Firefox, but errors with Safari and Chrome. Running on an Apache server with PHP v5.2

  21. Turns out the plugin is messing with the .htaccess file. It worked fine for a long time so I’m not sure what happened. I think it is conflicting with custom permalink structures.

  22. This plugin is perfect for what I need, but one thing is missing : it doesn’t work for sticky notes.
    I’d like to create a special category to be visible for public users only – that’s the easy part and works fine with the plugin as is.
    However, I want the posts in this category to always show at the beginning, as the posts will contain text to entice people to log in. The only way to ensure the post will be at beginning is to use sticky notes.
    Now, if I set a note as sticky, it’ll be displayed for all users regardless of plugin setting…
    Can sticky notes be taken in consideration as well?

  23. Hi James.
    When I use your plugin in my offline server in a site then everything is working fine, but when I use in public site, then I have a problem. I’l try to explain what really I mean. Wwhen I press some category (with premition only for user) from list, then I’m redirected to login site, an then after enter correct login and password I should be redirected to category which I selected before right? , but unfortunately I’m not redirected, What hapen after is login site asking me 3 times for login and password and then I’m redirected to user profile ,which is incorrect. It’s very strange, becouse when I use i.e http://www.yoursite.com/wp-login.php , then login site asking for login and password only ones.
    Please Jame help me some how, where I should change the code to work this great plugin fine.

  24. Hey James,

    It would be great if you could update Allow Categories to work with WordPress 3.0. Currently, if you enable the plugin, *you cannot create or edit any pages*. So if I want to have pages, I have to disable the plugin, create or edit the content, and then enable it again.

    We’re all indebted to you for the great plugin – but sometimes life gets in the way. If you don’t have time to maintain it, it would be awesome if you could pass it on to someone who can!

  25. I use the coffe2code get recent post:

    it has an argument:
    $categories = ”, // space separated list of category IDs — leave empty to get all
    how do I integrate your restricted list of categories in this??

    Grateful if you could help me.

  26. Hi James, I just developed a new function for the plugin.
    The point is to filter the navigation menu, so that the non-public categories don’t show if you’re not logged-in.
    I’m totally new at this so can I send you the modification and you update the plugin directly.
    If you don’t want to do it I can register a new plug in with both our code in it.
    aska.

  27. James,

    I m bit puzzled about the ”redirect” feature. If I tick the box ”Redirect to login if not permissioned” I would expect the non-registered user to be pointed to the login page. Instead a ”Page not found” appears. Is this how itțs supposed to work or am I missing something.

    Right now, this is the only ticked box in the settings section. All others are clear.

    Many thanks!

  28. Hi James,

    I cannot find the managed/allow categories option. Where is it ?

    I am using wp 3.02

    Thnx !

  29. Overall this thing works great!

    The only problem that I’m running into is that it seems to block administrators from editing/deleting/etc. anything that has to do with the categories when logged into wp-admin.

    I dont know how hard it would be to add a default [allow all access] option for administrators, but that would deffinitely help. I hate having to de-active the plugin in order to manage the site from the backend.

    WP: 3.0.4

  30. WordPress version 3.1
    Allow category 0.6.6
    When I nwant to create a new post I get the message:
    You are not autorised to delete posts in this category.

    i disable the plugin “allow categorie: , and then I can create a new post.

    What could be the problem?

  31. Hi James,

    Is it possible to have it work for child/parent categories without checking the child categories individually?

    Hope to hear from u soon.
    Thanks!

  32. Hello,
    I love your plugin, but I see two things I would like to know:

    1. Is there a way to mod it to redirect a user to a page if they aren’t allowed to see that category (eg the home page) but not force them to log in again?

    2. More importantly, i have a sidebar I include on all PHP files that calls subpages. The problem is that I dont want the sidebar called if the user isn’t allowed to see that category. The plugin successfully blocks the actual content from showing, but does not block sidebar. Is there a way to “test” (Eg a conditional) such as so i dont display content?

  33. We’ve made use of Allow Categories for our children’s theater web site. I’m wondering if you might modify the management page to list the users alphabetically in your next update.
    Thanks!

Write a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.