WordPress.org

Ready to get started?Download WordPress

Forums

Role Scoper
[resolved] Category Roles and Site Roles interference (2 posts)

  1. Hello there,

    I just updated from 1.1.7 to 1.2.7 and noticed a bug. I have "split" a website in "sections" using Role Scoper with Category Roles and Site Roles.

    Let's say a user (subscriber) is in Group A, which should be able to maintain pages with one specific parent. We can call these pages (including the parent) Block 1. Group A should also handle all posts in Category 1. To do this I have used the following settings in Role Scoper:

    GENERAL
    Page Author: Group A - this is ticked so users in Group A can add new pages (to Block 1).

    CATEGORIES
    *Category 1*
    Post Editor: Group A - Group A can only add new posts in this category, the others will be hidden/excluded.

    SITES
    *Block 1 parent*
    Page Editor: Group A
    *Block 1 sub-pages*
    Page Editor: {Group A}

    Now, this worked fine in version 1.1.7. But after the upgrade, all categories are shown to users in Group A, thus the Category Roles are somehow ignored or overruled.
    If I remove the General Role (Page Author), the categories get excluded and only Category 1 are shown in the editor - as wanted. However, this means that Group A cannot add new pages in Block 1 (only edit existing ones).

    I have tried to find the bug myself, but I don't really know where to look for the "category exclusion function".

    How do I solve this?

    Thanks. And thanks for this wonderful plugin!

  2. kevinB
    Member
    Plugin Author

    Posted 3 years ago #

    I can confirm this bug in 1.2.7 as well as the current 1.2.8 beta.

    To fix it, modify query-interceptor_rs.php as follows:

    change:

    if ( $reqd_caps_by_otype == array( 'post' => array('read') ) ) {
       $page_taxonomy_usage = scoper_get_otype_option('use_term_roles', 'post', 'page');
       if ( array_intersect( $page_taxonomy_usage, array(1) ) )
       $reqd_caps_by_otype ['page'] = array('read');
    }

    to:

    if ( array_intersect( array_intersect_key( scoper_get_otype_option('use_term_roles', 'post', 'page'), array_flip($taxonomies) ), array(1) ) ) {
       if ( $reqd_caps_by_otype == array( 'post' => array('read') ) )
          $reqd_caps_by_otype ['page'] = array('read');
    } else
          $reqd_caps_by_otype = array_diff_key( $reqd_caps_by_otype, array( 'page' => true ) );

    I have a cleaner implementation in the works for version 1.3, but this should fix the functionality for now.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic