• Thanks for the plugin! Much simpler and more efficient than User Access Manager that I used before (fits my needs better).

    However, there is a bug that can be easily fixed (I’m using newest plugin’s version – 2.5). The problem was that I restricted Author access to ‘uncategorized’ by default, but then I set some individual user restrictions. After saving, those users that I had not changed restrictions individually (no categories were checked for them), actually saw all of the categories, instead of just ‘uncategorized’.

    I traced the problem to line 397, originally:

    $settings_user = get_option( 'RestrictCats_user_options' );
    
    /* Selected categories for User overwrites Roles selection */
    if ( is_array( $settings_user ) && !empty( $settings_user[ $user_login . '_user_cats' ] ) ) {
    	/* Strip out the placeholder category, which is only used to make sure the checkboxes work */
    	$settings_user[ $user_login . '_user_cats' ] = array_values( array_diff( $settings_user[ $user_login . '_user_cats' ], array( 'RestrictCategoriesDefault' ) ) );

    Saving user settings adds ‘RestrictCategoriesDefault’ to all the users in the page, which means that for all those users $settings_user[ $user_login . '_user_cats' ] will not be empty.

    The simple solution is to move the lines around like this:

    /* Get selected categories for Users */
    $settings_user = get_option( 'RestrictCats_user_options' );
    
    /* Strip out the placeholder category, which is only used to make sure the checkboxes work */
    $settings_user[ $user_login . '_user_cats' ] = array_values( array_diff( $settings_user[ $user_login . '_user_cats' ], array( 'RestrictCategoriesDefault' ) ) );
    
    /* Selected categories for User overwrites Roles selection */
    if ( is_array( $settings_user ) && !empty( $settings_user[ $user_login . '_user_cats' ] ) ) {

    I don’t think this messes anything else up.

    https://www.ads-software.com/extend/plugins/restrict-categories/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Restrict Categories] Role vs. user restrictions’ is closed to new replies.