I'm very familiar with roles and capabilities. I use custom roles and caps on most sites as I build large ones with many editing users. Because I have many roles, it's easier to do a capability check than a role check. For example, I have a settings page which only certain roles can edit: administrator, webmaster, seo admin, analytics admin. Instead of adding all those roles, just doing a manage_options
cap check works better.
I looked at the source for this extension and was easily able to add support for this:
In file class-mb-include-exclude.php
Line 75, add , 'capability'
to the array.
Line 253, insert
/**
* Check by current user capability.
*
* @param array|string $capabilities List of user capabilities. Array or CSV.
*
* @return bool
*/
protected static function check_capability( $capabilities ) {
$user = wp_get_current_user();
$capabilities = array_map( 'strtolower', self::csv_to_array( $capabilities ) );
foreach ( $capabilities as $capability ) {
if ( $user->has_cap( $capability ) ) {
return true;
}
}
return false;
}
Then in your meta box config, add:
'include' => array(
'capability' => 'manage_options',
),