Support » Plugins » [Plugin: Role Scoper] Problem Displaying Custom Fields with RS

  • Resolved fredhead


    I’m using Custom Post Type UI to create content post types (an FAQ), Advanced Custom Fields to define field types for the custom post types, and Role Scoper to manage access to creating FAQs and viewing FAQs. All three plugins appear to work (on LAMP, PHP5).

    However, when I login with a test account set to permissions WP-Author, the custom fields do not appear. When I deactivate Role Scoper and login with the same account, the custom fields do appear. While I can’t find it today, yesterday I came across one or two posts on the internets that said to set the WP-Author role as FAQ Author and WP-Editor role as FAQ Editor. That did not fix the issue. I’d appreciate help debugging.

    First, here are the assigned permissions for my author test account, what appears on the login’s profile page:

    Scoped Roles
    Assigned WordPress Role: Author
    (contains Link Reader, Post Reader, Post Contributor, Post Author, Page Reader, FAQ Reader, Document Reader)

    Additional General Roles: Category Assigner, Document Contributor, FAQ Author, Post Tag Assigner, Private Document Reader
    (contains Document Reader, FAQ Reader, FAQ Contributor)

    Second, here’s the output from Roles > General in Role Scoper for my FAQ custom post type:

    FAQ Reader
    Private FAQ Reader
    FAQ Contributor
    FAQ Author Groups: [WP author]
    FAQ Editor Groups: [WP administrator], [WP editor]
    Category Manager
    Category Assigner Groups: [WP author], [WP editor]
    Post Tag Manager
    Post Tag Assigner Groups: [WP author], [WP editor]

    With Role Scoper on, what this author login does see on the Add/Edit an FAQ page is the Title field and the WYSIWYG textarea (or a version of it).

    Finally, in searching yesterday, one possible solution had to do with timing for each of these plugins, when they were fired off. However, I can’t find the URL and I have no idea how to make that happen. If you think that’s the issue, could you also explain how to adjust what WordPress processes first, second, third.

    BTW Role Scoper works great filtering content based on categories and roles. The only issue I’m having is this one which appears to be caused by Role Scoper (because the custom fields appear fine when Role Scoper is deactivated).

    Any ideas what settings I should check? Thank you!

Viewing 15 replies - 1 through 15 (of 26 total)
  • Thanks for the extensive configuration data. I’ll look into this after returning from vacation next week.

    Thanks, Kevin! Let me know when you’re ready and I’ll give you whatever data/access you need to help figure it out. Enjoy your time off.

    I’m back from vacation and will be in Role Scoper support mode for the next day or two. You can send additional data through my contact form.

    Non-display of Advanced Custom Fields metaboxes is fixed in the updated Role Scoper development code (1.3.41-dev).

    Thanks, Kevin, and welcome back (if coming back from any vacation is a good thing). I’ll check out the dev code.

    While waiting I’ve cobbled together the hand coded custom fields in my functions.php file which did work with Role Scoper before for the most part. Having today rebuilt my test site, tomorrow I plan to re-active RS and add back all the accounts to test everything. Basically I have a set of external users who are all Subscribers in the WordPress world who I want to permission at the category level with RS. Then I have a group of internal users who I want to simply use the WordPress levels of Author, Editor, and Admin.

    I’ll let you know how it goes.

    Hi Kevin, if you’re still subscribed to this post:

    I have three users/roles:

    Role 1
    Role 2
    Role 3

    I also have four categories and subcategories:

    Cat 1
    Cat 2
    SubCat A
    SubCat B
    Cat 3
    Cat 4

    For testing, I have one user. My goal is to have the user be able to see only content assigned to their group and categories assigned to their group. The user is a reader, not an editor, author, or admin. In the WordPress permissions scheme, users are “No Role for this Site.”

    I have this immediate scenario/problem:

    The user is assigned to Cat 2 and SubCat A. They should only see content assigned to SubCat A, not SubCatB. The problem is that assignment to Cat 2 appears to include SubCatB items when I log in as the user and view category links. How do I refine the permissions so the user, in this scenario, only sees content assigned to Cat 2 and SubCat A?

    Most likely I’m misunderstanding the nature of Role Scoper, or there are so many screens in RS my head is exploding. But let me know how to use RS to truly limit users to the categories to which they are assigned.

    Make sure the Category Role assignment on Cat 2 is “for selected category” and not “for selected and subcategories”. The latter (indicated by bolded user/group name in the Roles > Categories tables) causes the role assignment to propagate to all current and future subcategories.

    Thanks, Kevin! I missed that detail.

    A follow up question. On the Category Roles page, for each category I’ve assigned a group that roughly mirrors a set of categories, like this:

    Group 1 = Cat 1
    Group 2 = Cat 2
    Group 3 = Cat 3
    Group 4 = Cat 4

    For some categories, I want Groups 1, 2, and 3 to see entries tagged with multiple groups in the Category Roles page, like this:

    Cat 8 = Group 1, Group 2, Group 3
    Cat 9 = Group 1, Group 3

    In this scenario, category tagged content for Group 1 is showing up in the category links on the right of my pages (2010 theme). The logged in user is assigned to Group 2 to see only category 2 content. I’ve determined the problem is that it’s because Groups 1, 2, 3 are assigned to category 8 and so all content tagged with Category 8 displays when you click the category 8 link, regardless of any category restrictions. Category Roles appears to take precedence over Category Restrictions.

    Any way to untangle this? Specifically, is there a best practice for how to organize categories and groups?

    I don’t understand your desired behavior. If you have given all 3 groups a Post Reader role for Cat 8, don’t you want all those groups to see the Cat 8 posts?

    Yes except the other category relationship and restriction gets ignored in this second scenario. All content tagged with Cat 8 is displayed regardless of any other category restriction. Category Role assignment to Cat 8 appears to take precedence over limiting Cat 2 to Group 2 regardless of any other assignment. I want the reverse effect.

    It’s confusing, perhaps, and my apologies. Mostly I’m looking for best practices for limiting content access based on categories, sub-categories, and groups.

    First off, access cannot be limited based on group. Category Roles (whether assigned per-user or per-group) only expand access beyond what the user has from the WP Role or RS General Role. They do not limit a category to a particular group.

    If the Post Reader role is restricted for all categories of any given post, that post will not be visible without a Category-specific or Post-specific Role assignment.

    Post Restrictions (set in Roles > Posts or in the Post Edit Form) can be set to require a post-specific role assignment (overriding WP / General and Category Roles).

    Based on what I know of your requirements, I’d suggest setting a default Category Restriction (“default for all categories”) on the Post Reader role. Then simply assign Category Roles to each desired group per-category and use Post Restrictions/Roles to further customize that as needed.

    Okay, thank you for the clarification. The key, I think, is to control at the Post/Article level. I was thinking at the site admin level but, in practice, once basic permissions are set, authors will determine who sees content.

    I have one question. On the Add/Edit a Post/Article form, I see this checkbox, “Restrict for Article Item (only selected users/groups are Readers)”. This appears to override any /Group Name/ settings, permissions gained by other settings. Is there a way to make this checked off by default? That would help force authors to select groups who can see the content.

    I’d also ask if there is a way to hide the Contributor and Author checkboxes on the Add/Edit forms.

    Appreciate your help and clarifications!

    Hi, now I’m getting another problem: once RS is enabled, my custom types don’t show their menus properly. When I go to Roles > Options > Realms > Post Type Usage and un-check my custom content types, the full menus come back.

    I have three custom content types that work fine and use exactly the same code except for obvious differences (e.g. the type name used in calling register_post_type. The types are Articles, Documents, and FAQs. On the left side admin menu in WordPress, the menus (e.g. Articles, Add New, and Categories) display fine until I activate RS or shut off Post Type Usage.

    More weird: when I’m in the RS Role pages, the left navs display fine. When I go to another tab with the WP Dashboard and click Refresh, the navs are not fine based on the Post Type Usage settings.

    Any ideas what settings I need to access my custom content types with RS? Anything I should watch out for? I want to leave the WordPress roles “as is” for authors, editors, and admins. I only need to manage roles for site visitors. Thanks.

    Activating a post type for RS filtering forces its capabilities to be customized (otherwise RS filtering is impossible).

    Non-Administrators won’t be able to see the CPT menus (or edit the custom posts) until you give them the corresponding capabilities as listed in RS Role Defs > * Editor. You can do so by manually editing the WP role defs or by assigning a General role to the desired WP role group.

    Well that’s the mystery. I’m logged in as an admin, the original account used to set up the WP install. And I see the first CPT menu (Articles) but not the two other CPT menus. In theory, I should see all three menus. And when, in another tab, I refresh an Edit page for the blocked CPT, I get a permissions error (“You are not allowed to edit this item”).

    So I went into Roles > General, selected [WP Administrator] and then checked off the Editor role for Posts, Pages, Articles. The same two CPT menus still are blocked and I still get the Edit page error for a blocked CPT.

    And in Roles > Options > Realm > Access Types, I have the last item, “Editing and administering content (admin)” unchecked. Shouldn’t that take RS off WP roles and off the WP admin pages?

    What am I doing wrong?

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘[Plugin: Role Scoper] Problem Displaying Custom Fields with RS’ is closed to new replies.