• Resolved Alex Stine

    (@alexstine)


    Hello,

    I have a project that I am building for a local school. I am attempting to customize some capabilities and what I need to do is far to advanced for a plugin such as User Role Editor although I’m using that plugin as well.

    Picture this. There are a couple custom roles:
    – Student
    – Teacher
    Students can do pretty much everything a Contributor can do, edit their own posts, trash their own posts, after publishing, and upload media.
    Teachers should have the same capabilities plus publishing.

    Now here’s the trick. I would like the Teacher role to be able to edit, delete, and publish only their own and posts made by Students. How can I filter the capabilities and roles in such a way to only allow users with the Teacher role to have permissions to perform these actions for the Student role?

    Hope someone can guide me in the process. I’m very new to PHP.

    Thanks for your help. ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • You can use a plugin to help you manage your user roles, try checking some of the popular User Role plugins that are available to you.

    Hope this helps.

    Thread Starter Alex Stine

    (@alexstine)

    Thanks for your response @themesumo.

    I honestly cannot find a plugin that does the customizing of roles and capabilities such as explained in my example above. I don’t want to allow one role to have the “edit_others_posts” capability, I only want said role to have that capability if post was published by a specific role.

    Bob: Student
    John: Teacher
    Jim: Editor
    John should only be able to edit, trash, publish, ETC Bob’s posts.

    Hope that makes sense.

    With such specific a request, you would probably have more success by hiring a developer over at the WP Jobs board who could customize an existing plugin to suit your needs.

    Hope this helps.

    Thread Starter Alex Stine

    (@alexstine)

    @themesumo

    I don’t have that kind of money, so I think I’ll leave this open and see if it attracts a solution or good starting point.

    Thanks.

    Moderator bcworkz

    (@bcworkz)

    The problem is the capabilities check does not use any kind of complex logic. One either can or cannot do something, not can do something if something else is true.

    Consider a custom post type for student posts. Then you can create a completely separate set of capabilities that do not affect the usual WP roles. Teachers will have edit others custom posts capability, but since only students can create such custom posts, it has the effect you desire without affecting current normal post capabilities.

    These sort of posts can be included in normal post queries so that visitors wouldn’t need to know there is a separate post type for students. Or the difference can be promoted, your choice.

    This is pretty involved for someone new to PHP, but if you have any kind of coding experience, it won’t be hopeless. You can find example snippets from which to build upon, so it’s not like you are starting from nothing. We can help you out when you get stuck on something, but most of the coding work will have to be on you.

    Start by making a custom plugin that creates a custom post type with related capabilities. Build upon this foundation a little at a time and you’ll eventually get everything working.

    Thread Starter Alex Stine

    (@alexstine)

    @bcworkz, thanks. Just needed to know the place to start, marking resolved. ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Customizing Roles and Capabilities for a School Based Site’ is closed to new replies.