WordPress.org

Forums

Can you restrict users to write to only 1 category? (41 posts)

  1. dollpage
    Member
    Posted 9 years ago #

    Is it possible to restrict a user to being able to post (write) to one category only?

    What I want to do is use WordPress as a news fed site for an online mall. Each user on the site is a store owner in the mall, and I wanted to make it so that when they log in and write a post, the post will be written to 'their' category.

    For instance, Mary owns 'A Dolls World" which is a store in the mall. So I create a category called "A Dolls World"

    When Mary logs in and goes to write a post, the way it is now is that she can select which category she will post in. But as many new users are likely to do, she may forget to check 'her' category and post to the default category instead. I would like to make it so that she can only post in her own category.

    Is this possible?

    And, BTW, perhaps there's a better way of doing this altogether. Allow me, if you will, to ask this:

    My idea is to create a category for each store in my mall and allow store owners to have their own news feed.

    My limited experience with WordPress allowed me only one idea on how to do this; by setting up a category for each store owner.

    This way, every time a store owner posts a news item, (and assuming the user put the item in their own category, the item would show up on the front page as well as in their category. Fans of that user could subscribe to that particular category, which would keep them updated on anything new in that users store.

    The news item would also show up on the front page, allowing fans of the entire mall to subscribe to the entire site rather than one or two individual stores.

    Is this one-category-per-store the best way to accomplish this, or am I missing some bigger picture.

    Thanks!

  2. MichaelH
    Member
    Posted 9 years ago #

    At least start by looking at the Limit Category plugin
    http://redalt.com/wiki/Limit+Categories

    that Plugin was listed here:
    http://codex.wordpress.org/Plugins/Restriction

  3. dollpage
    Member
    Posted 9 years ago #

    Thanks, but that won't do it.

    That plugin will restrict users of a certain level, (contributor, author, etc) to post to single category.

    What many of us want (for different reasons) is a way to basically give every user his own category and restrict his posts to that category only.

    In my case, I have aproximately 200 store owners. I'm giving each store owner his own category, (mary's doll shop) where they can post items of interest that have to do with their store. These items will, by default, also show up on the main page.

    The main page will be fed to the RSS readers, and each individual store will have it's own individual feed so that fans of a particular doll shop will be kept abreast of any new items in that particular shop buy subscribing to that feed.

    Right now, when mary's doll shop posts an article, she has to find her category from a list of 200, and check it, or the article will go into the default category. Of course it can be edited later and placed in the right category, but who wants to do that when you could do it right the first time. (if that was possible here.)

    The category restriction plugin only allows restriction of user levels to a particular category, but cannot restrict a user of any level to one category.

    Thanks for giving my question a shot, though! And I also appreciate all the other free support offered by WordPress!

    Dollpage

  4. moshu
    Member
    Posted 9 years ago #

    With some (a lot of?) work you can find a workaround.
    Using the Role Manager plugin you could create a new "role" for every user and limit that role to his/her own category.
    Well, I know it's crazy :) - but I can't think of anything else right now...

  5. mozey
    Member
    Posted 9 years ago #

    limit category is only for 1.5,

  6. vkaryl
    Member
    Posted 9 years ago #

    Dollpage, you might look into wordpress MU: http://mu.wordpress.org. What you've got there that you need is more like a multi-user blog setup.

  7. manstraw
    Member
    Posted 9 years ago #

    You don't really need categories. You can simply have everyone post uncategorized (renamed it what you like), and then create links to the authors posts. So instead of a list of categories, you have a list of authors, and clicking an author will bring up a page of their posts.

  8. mozey
    Member
    Posted 9 years ago #

    Manstraw, nice idea, however, what if i would like my users to post ONLY to uncatagorized?

  9. manstraw
    Member
    Posted 9 years ago #

    Then only have uncategorized as a topic. I can't remember if a regular Author can create a category, but I don't think they can. The Role Manager plugin let's you adjust the capabilities if you need that.

  10. mozey
    Member
    Posted 9 years ago #

    no no no no no!, there SHOULD be an elegant way to restrict a group of users to a group of catagories. Depending on what your topic is, Its really unrealistic to have ONLY one category!

  11. manstraw
    Member
    Posted 9 years ago #

    For the OP's requirements, what I've suggested is completely appropriate.

    And there is an elegant way to restrict a group of users to a group of categories. A combination of the Role Manager and Limit Categories plugins does exactly that. Create a role, limit categories for that role. Done. The OP's needs are atypical, in that he wants a one to one relationship between category and user, which ultimately makes categories redundant.

  12. mozey
    Member
    Posted 9 years ago #

    thanks for your reply manstraw.

    1:I am running role manager and it is working like a charm, however, limitcats.php V 1.5.2 crashes with this output in my httpd-error:

    /rootdir/blablabla.com/wp-content/plugins/limitcats.php(297) : Parse error - syntax error, unexpected '}'

    I did some research on it, he is defining a class which contains more than one php block. And i guess php does'nt like that very much. thats my best theory.

    I'm running php5!!, i dont know where else to go from there, any ideas?

    2: what do you mean by OP?

  13. vkaryl
    Member
    Posted 9 years ago #

    OP = Original Poster.

  14. tsguitar
    Member
    Posted 9 years ago #

    That syntax error looks to me like it's just a wayward bracket that's misplaced. Can you wade through the code and make sense of it? Can you maybe post the code as a text file so the rest of us can glance through it to hunt down the problem? That syntax error doesn't appear to be a complete deal breaker, it's just got a slight problem but will probably still work fine.

    And I agree that this sounds like a WordPress MU thing. Either that or author pages as the different stores in the online mall, as manstraw suggested. With that method, there would be no categories; the author display names would be the names of the malls you want represented. Do away with categories and have the author display names categorize everything. That's actually a rather elegant way around this. Think of how your users will experience that: they wouldn't have to worry about categories at all. They'd just need to type their entries and publish.

  15. manstraw
    Member
    Posted 9 years ago #

    I've got role manager and limit categories intalled on one of my blogs and they've working fine. It's only version 2.0.3 of wordpress though. Role Manager is version 1.4.4 and Limit Categories is 1.5.2.

    Because I have the same version of limit categories, and I don't have a parse error, I recommend you redownload and reinstall it. A parse error happens before execution. It simply means there is a missed or extra character somewhere. A fresh download/install should take care of that.

  16. mozey
    Member
    Posted 9 years ago #

    I just downloaded a fresh copy and there, it is giving me the exact same error!!!!!!!!

    [Fri Aug 11 07:01:05 2006] [error] [client IP] PHP Parse
    error: syntax error, unexpected '}' in /rootdir/wp-content/plugins/limitcats.php on line 247

    that is UNTOUCHED code on his site!, which makes me REALLY believe that there maybe something wrong with my setup!. HOWEVER, here is the code incase you would like to look at it.

    http://www.guitargeartalk.com/limitcats.php.txt

    Thank you for your guy's reply,

  17. mozey
    Member
    Posted 9 years ago #

    oh yeahh, if this is of any help,

    php5
    mysql5
    apache 2.2
    FreeBSD 6.1

    i looked at the code allready, there are the same amount of {s as there are }s. NOthing else jumps at me EXCEPT for having a class definition in multiple <?php blocks. But php is not my game, so i dont know, :)

    Thanks again,

  18. tsguitar
    Member
    Posted 9 years ago #

    As far as brackets go, that PHP looks good to me. manstraw, can you post your version of that plugin, the version you have working (I know they are the same version number, but perhaps something happened and you have a better version)? And if that code is copied and pasted into mozey's site and there's still a parse error, something else is going on.

    mozey, does your site work fine other than this issue?

  19. mozey
    Member
    Posted 9 years ago #

    tsguitar, good thinking,

    and yes, everyhthing else is good!, to the best of what i can tell, One plugin i have gives me some warnings, but i cannot see how that would effect it.

    If there is an output that you would like to look at please let me know, thanks,

  20. manstraw
    Member
    Posted 9 years ago #

    ok, here yas go. http://mybeausejour.com/wordpress/wp-content/plugins/limitcats.php.txt

    I haven't looked at yours to see if it's different.

  21. mozey
    Member
    Posted 9 years ago #

    Manstraw, i am taking a stab that you are running a different version of php than the one i'm running (5.1.4). And i think the one i'm running inforces the one <?php block per class rule, Keeping that in mind, i'm going to edit the code to suffice that. and i'll keep you updated.

  22. mozey
    Member
    Posted 9 years ago #

    Aright, so i fixed that!, and NOTHING!, anyone running php5 along with limitcats.php at all? or am i the only one?

  23. manstraw
    Member
    Posted 9 years ago #

    yeah, my php is probably around 4.3.2.

  24. bitbrew
    Member
    Posted 9 years ago #

    I'm also interested in getting this sort of thing working. I would like to have any user be able to be restricted to posting in a certain category. Has anyone seen a plugin on this?

  25. manstraw
    Member
    Posted 9 years ago #

    have you read this whole thread? the limit categories plugin combined with the role manager plugin allow you infinite possibilities in controlling which categories users can post to.

  26. bitbrew
    Member
    Posted 9 years ago #

    Yeah, but it's definitely a kluge. I'm looking for something that would restrict access by user_id as compared to restricting access by user_role.

  27. mozey
    Member
    Posted 9 years ago #

    why? what does user_id comparison offer that user_role comparison does'nt?

    wordpess multuser should be implemented like that tho. I"m downgrading to php4 for catlimits.php :) it does the job.

  28. manstraw
    Member
    Posted 9 years ago #

    Well, Category Access restricts by user_id, but it also restricts reading (it's main purpose). Perhaps you can bribe the author with a wild night at your place and all the kool-aid he can drink, and he'll make you something that only restricts posting instead of reading. But I still think that doing it with roles is more powerful/flexible.

  29. mozey
    Member
    Posted 9 years ago #

    OKAY, confirmed, catlimits.php (catagory limits) does not work on php5, i just downgraded to php4 and it works like charm. :) i really want this plugin, and i do NOT want to program.

  30. manstraw
    Member
    Posted 9 years ago #

    have you contacted the author? perhaps he/she is interested it making it work with 5, or has some insight?

Topic Closed

This topic has been closed to new replies.

About this Topic