wp-admin10x
wp-admin10x copied to clipboard
Author roles are hardcoded and cannot be adjusted
The issue is that you cannot alter the author's roles you would like to cache. It would be helpful if you can do that, for example, when your WP instance has additional roles defined with some custom capabilities.
File: admin10x/admin10x.php:118
Before:
add_action('set_user_role', function($user_id, $role) {
$a10x = new Admin10X();
$author_roles = array('administrator', 'author', 'editor');
if ( in_array($role, $author_roles)) {
$a10x->add_author($user_id);
} else {
$a10x->del_author($user_id);
}
}, 10, 3);
After:
add_action('set_user_role', function($user_id, $role) {
$a10x = new Admin10X();
$author_roles = apply_filters('admin10x_author_roles', array('administrator', 'author', 'editor'));
if ( in_array($role, $author_roles)) {
$a10x->add_author($user_id);
} else {
$a10x->del_author($user_id);
}
}, 10, 3);
I would love to contribute to the project if possible.