I am trying to allow the custom role bbp_moderator
to view the Users
Section from wordpress backend, but for some reason is not working. i can see the roles via the $wp_roles
global variable and the capability edit_users
had been added the the bbp_moderator
role.
function add_capablilities_to_mod() {
$role = get_role('bbp_moderator');
$role->add_cap('edit_users');
}
function add_user_table_to_moderator() {
global $wp_roles;
//
//var_dump(current_user_can( 'bbp_moderator' )); -> true
if ( current_user_can( 'bbp_moderator' ) ) {
add_action( 'plugins_loaded', 'add_capablilities_to_mod' );
}
}
add_action('init', 'add_user_table_to_moderator');