Title: thomasfw's Replies | WordPress.org

---

# thomasfw

  [  ](https://wordpress.org/support/users/thomasfw/)

 *   [Profile](https://wordpress.org/support/users/thomasfw/)
 *   [Topics Started](https://wordpress.org/support/users/thomasfw/topics/)
 *   [Replies Created](https://wordpress.org/support/users/thomasfw/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/thomasfw/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/thomasfw/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/thomasfw/engagements/)
 *   [Favorites](https://wordpress.org/support/users/thomasfw/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Reviews](https://wordpress.org/support/forum/reviews/)
    In reply to:
   [[Disable Comments - Remove Comments & Stop Spam [Multi-Site Support]] 🤢](https://wordpress.org/support/topic/%f0%9f%a4%a2/)
 *  Thread Starter [thomasfw](https://wordpress.org/support/users/thomasfw/)
 * (@thomasfw)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/%f0%9f%a4%a2/#post-13855665)
 * I’m not going to waste my time repeating the obvious, just take a look at one
   of the many recent negative reviews if you need a full breakdown.
 * Getting rid of all the bloat that’s just been added would be a good start.
 * Cheers
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Private groups] Add filter for changing capability for accessing settings pages](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/)
 *  Thread Starter [thomasfw](https://wordpress.org/support/users/thomasfw/)
 * (@thomasfw)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/#post-7089490)
 * You’re completely right, not sure how I overlooked that one.
 * Cheers
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Private groups] Add filter for changing capability for accessing settings pages](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/)
 *  Thread Starter [thomasfw](https://wordpress.org/support/users/thomasfw/)
 * (@thomasfw)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/#post-7089486)
 * Yep the first block would go in my theme or plugin.
 * The second block would go in settings.php in addition to the filter that was 
   added in 3.1.8.
 * Thanks
 * (Have you thought about getting up on github? I’d be happy to contribute)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Private groups] Add filter for changing capability for accessing settings pages](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/)
 *  Thread Starter [thomasfw](https://wordpress.org/support/users/thomasfw/)
 * (@thomasfw)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/#post-7089482)
 * Hi Robin
 * Sorry to bother you again! I’ve realised that whilst the above will allow users
   with the filtered capability to access the settings page, they won’t be able 
   to actually submit any of the forms as they don’t have the correct cap for that(
   manage_options).
 * I’ve added a fix for this below. It allows us to specify the cap required to 
   submit a particular option form. So I could allow keymasters to submit only the‘
   group settings’ form using..
 *     ```
       add_filter('rpg_plugin_group_settings_capability', 'mytheme_bbp_private_groups_settings_access');
       function mytheme_bbp_private_groups_settings_access($cap) {
       	return 'publish_forums';
       }
       ```
   
 * It would go in includes/settings.php just after line 414 (after rpg_register_settings()).
 *     ```
       // ALLOW US TO SPECIFY WHO CAN MANAGE CERTAIN SETTINGS:
       // ---------------------------------------------------------------------------------------
       function rpg_forum_page_capability( $capability ) {
       	$capability = apply_filters('rpg_plugin_forum_settings_capability','manage_options');
           return $capability;
       }
       function rpg_general_page_capability( $capability ) {
       	$capability = apply_filters('rpg_plugin_general_settings_capability','manage_options');
           return $capability;
       }
       function rpg_group_page_capability( $capability ) {
       	$capability = apply_filters('rpg_plugin_group_settings_capability','manage_options');
           return $capability;
       }
       function rpg_roles_page_capability( $capability ) {
       	$capability = apply_filters('rpg_plugin_roles_settings_capability','manage_options');
           return $capability;
       }
       add_filter( 'option_page_capability_rpg_forum_settings', 	'rpg_forum_page_capability' );
       add_filter( 'option_page_capability_rpg_general_settings', 	'rpg_general_page_capability' );
       add_filter( 'option_page_capability_rpg_group_settings', 	'rpg_group_page_capability' );
       add_filter( 'option_page_capability_rpg_roles_settings', 	'rpg_roles_page_capability' );
       // ---------------------------------------------------------------------------------------
       ```
   
 * Uses this hook: [https://developer.wordpress.org/reference/hooks/option_page_capability_option_page/](https://developer.wordpress.org/reference/hooks/option_page_capability_option_page/)
 * Thanks again
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Private groups] Add filter for changing capability for accessing settings pages](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/)
 *  Thread Starter [thomasfw](https://wordpress.org/support/users/thomasfw/)
 * (@thomasfw)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/#post-7089284)
 * Awesome, thanks very much!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Private groups] Add filter for changing capability for accessing settings pages](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/)
 *  Thread Starter [thomasfw](https://wordpress.org/support/users/thomasfw/)
 * (@thomasfw)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/add-filter-for-changing-capability-for-accessing-settings-pages/#post-7089243)
 * Thanks Robin, much appreciated. Basically the filter will allow anyone who hooks
   into it to change the capability. So with the new filter it’s possible to add
   the following into my theme’s functions.php or elsewhere..
 *     ```
       // Enable Keymaster access to the settings page:
       add_filter('rpg_plugin_settings_capability', 'mytheme_bbp_private_groups_settings_access');
       function mytheme_bbp_private_groups_settings_access($cap)
       {
       	return 'publish_forums';
       }
       ```
   
 * The value of $cap will default to ‘manage_options’ if the filter isn’t hooked
   into, otherwise it’ll be the value returned from the hooked function (see above
   example). $cap replaces the hardcoded ‘manage_options’ string in the add_submenu_page()
   function.
 * Cheers

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