Title: [Plugin: Role Scoper] Debug mode: need safer checking (patch)
Last modified: August 20, 2016

---

# [Plugin: Role Scoper] Debug mode: need safer checking (patch)

 *  Resolved [daveagp](https://wordpress.org/support/users/daveagp/)
 * (@daveagp)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-role-scoper-debug-mode-need-safer-checking-patch/)
 * Hi,
 * I run a version of my site with WP_DEBUG on and I get some warnings from your
   plugin. I’m attaching the patch of what I changed to prevent this (the changes
   are all trivial). Are you interested in merging this with the main repository?
   Thanks!
 *     ```
       diff -Naur ./cap-interceptor_rs.php ../role-scoper/cap-interceptor_rs.php
       --- ./cap-interceptor_rs.php	2012-02-24 16:29:50.000000000 -0500
       +++ ../role-scoper/cap-interceptor_rs.php	2012-06-18 00:18:52.000000000 -0400
       @@ -190,7 +190,7 @@
        		);
   
        		// for scoped menu management roles, satisfy edit_theme_options cap requirement
       -		if ( ( 'edit_theme_options' == $orig_reqd_caps[0] ) && empty( $wp_blogcaps['edit_theme_options'] ) ) {
       +		if ( array_key_exists(0, $orig_reqd_caps) && ( 'edit_theme_options' == $orig_reqd_caps[0] ) && empty( $wp_blogcaps['edit_theme_options'] ) ) {
        			if ( in_array( $GLOBALS['pagenow'], array( 'nav-menus.php', 'admin-ajax.php' ) ) || $doing_admin_menus ) {
        				$key = array_search( 'edit_theme_options', $rs_reqd_caps );
        				if ( false !== $key ) {
       @@ -222,7 +222,7 @@
        		} elseif ( is_admin() && ( 'edit-tags.php' == $GLOBALS['pagenow'] ) && ( 'link_category' == $_REQUEST['taxonomy'] ) ) {
        			$src_name = 'link';
        			$object_type = 'link_category';
       -		} elseif ( in_array( $orig_reqd_caps[0], array( 'manage_nav_menus', 'edit_theme_options' ) ) ) {
       +		} elseif ( array_key_exists(0, $orig_reqd_caps) && in_array( $orig_reqd_caps[0], array( 'manage_nav_menus', 'edit_theme_options' ) ) ) {
        			$src_name = 'nav_menu';
        		}
   
       @@ -712,7 +712,7 @@
        		$rs_reqd_caps = array_fill_keys( $rs_reqd_caps, true );
   
        		if ( ! $this_id_okay ) {
       -			if ( ( 'edit_posts' == $orig_reqd_caps[0] ) && strpos( $_SERVER['REQUEST_URI'], 'async-upload.php' ) ) {  // temp workaround for ACF with Revisionary
       +		  if ( array_key_exists(0, $orig_reqd_caps) && ( 'edit_posts' == $orig_reqd_caps[0] ) && strpos( $_SERVER['REQUEST_URI'], 'async-upload.php' ) ) {  // temp workaround for ACF with Revisionary
        				return $wp_blogcaps;
        			}
   
       diff -Naur ./hardway/cache-persistent.php ../role-scoper/hardway/cache-persistent.php
       --- ./hardway/cache-persistent.php	2012-02-24 16:29:50.000000000 -0500
       +++ ../role-scoper/hardway/cache-persistent.php	2012-06-17 21:19:51.000000000 -0400
       @@ -615,7 +615,7 @@
        		//rs_errlog ("<br />setting $id/$group:<br />");
   
        		// is_404() function is no longer available at the execution of this wpp_cache_close, so check it here
       -		if ( function_exists( 'is_404' ) && is_404() && empty( $this->is_404 ) )
       +		if ( function_exists( 'is_404' ) && isset( $wp_query ) && is_404() && empty( $this->is_404 ) )
        			$this->is_404 = true;
   
        		if ( ! empty( $this->is_404 ) )
       diff -Naur ./role-scoper_main.php ../role-scoper/role-scoper_main.php
       --- ./role-scoper_main.php	2012-02-24 16:29:50.000000000 -0500
       +++ ../role-scoper/role-scoper_main.php	2012-06-18 00:16:53.000000000 -0400
       @@ -889,7 +889,7 @@
   
        			if ( 'post' == $src_name ) {
        				if ( ! $operation )
       -					$operation = ( $this->is_front() || ( 'profile.php' == $pagenow ) || ( is_admin() && ( 's2' == $GLOBALS['plugin_page'] ) ) ) ? 'read' : 'edit';  // hack to support subscribe2 categories checklist
       +				  $operation = ( $this->is_front() || ( 'profile.php' == $pagenow ) || ( is_admin() && array_key_exists('plugin__page', $GLOBALS) && ( 's2' == $GLOBALS['plugin_page'] ) ) ) ? 'read' : 'edit';  // hack to support subscribe2 categories checklist
   
        				$status = ( 'read' == $operation ) ? 'publish' : 'draft';
       ```
   
 * [http://wordpress.org/extend/plugins/role-scoper/](http://wordpress.org/extend/plugins/role-scoper/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Kevin Behrens](https://wordpress.org/support/users/kevinb/)
 * (@kevinb)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-role-scoper-debug-mode-need-safer-checking-patch/#post-2951263)
 * Thanks, Dave
 * I have applied those changes to my local development source and will include 
   them in the next release (minus the ‘plugin__page’ typo).
 *  Thread Starter [daveagp](https://wordpress.org/support/users/daveagp/)
 * (@daveagp)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-role-scoper-debug-mode-need-safer-checking-patch/#post-2951280)
 * Awesome thanks for catching the typo too!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Role Scoper] Debug mode: need safer checking (patch)’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/role-scoper.svg)
 * [Role Scoper (Obsolete - Please install PublishPress Permissions)](https://wordpress.org/plugins/role-scoper/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/role-scoper/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/role-scoper/)
 * [Active Topics](https://wordpress.org/support/plugin/role-scoper/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/role-scoper/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/role-scoper/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [daveagp](https://wordpress.org/support/users/daveagp/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-role-scoper-debug-mode-need-safer-checking-patch/#post-2951280)
 * Status: resolved