• Is there any ‘good’ and easy solution for adding extra user roles to WordPress and give them access to a part of the website?

    I’m working on a website for an organization. The goal is that everyone can view the website, the blog, … but that the members of the organization (who are logged in) view a category. No one else should have access to that category.

    Which plugins should I use? Or are there any WordPress build-in functions that I don’t know?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi MathiasB,

    One good role-management plugin I’ve used is Members, by Justin Tadlock: https://www.ads-software.com/extend/plugins/members/

    It also sounds like you may just want to hide certain things based on whether users are logged in. If you only accept registrations from members (essentially invite-only), using the is_user_logged_in function might be helpful too.

    Thread Starter MathiasB

    (@mathiasb)

    I also want ‘normal’ users to be able to register.
    Also when some one leaves the organization we only change the role, but keep the user.

    Is it possible to get the current user role out of WordPress in the php?

    Is it possible to get the current user role out of WordPress in the php?

    You can actually test against what capabilities a user has. So for example, let’s say you wanted to test against a logged-in user who has the capability Editor or above. You could use something like this:

    if ( is_user_logged_in() && current_user_can( 'edit_others_posts' ) {
    // Something goes here
    }

    You can read more about the default roles and capabilities in the Roles and Capabilities Codex article. Hope that helps.

    Thread Starter MathiasB

    (@mathiasb)

    That will help me out, but not totally, because I don’t want everybody to be able to edit content…
    I’ll take a closer look at your url.
    Thx already…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add user roles and permissions’ is closed to new replies.