Ready to get started?Download WordPress


Add user roles and permissions (5 posts)

  1. MathiasB
    Posted 1 year ago #

    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?

  2. Hi MathiasB,

    One good role-management plugin I've used is Members, by Justin Tadlock: http://wordpress.org/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.

  3. MathiasB
    Posted 1 year ago #

    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?

  4. 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.

  5. MathiasB
    Posted 1 year ago #

    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...

Topic Closed

This topic has been closed to new replies.

About this Topic