I have create a new user role.
add_role('lln_assessor', 'LLN Assessor', array(
'read' => true,
));
this role will access a custom admin menu page .
add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
global $user_ID;
if ( current_user_can( 'lln_assessor' ) ) {
add_menu_page('Axcelerate LLN','LLN Datas','read_assess_lln', 'Axcelerate_Link_Admin_lln_data','axcelerate_link_admin_lln_data_fn','','1.0' );
}
}
but first I must create a custom capability for it.
$role_object = get_role( 'lln_assessor' );
// add $cap capability to this role object
$role_object->add_cap( 'read_assess_lln');
but the issue when I try to access the 'LLN Datas' menu in the admin dashboard I got this error.
You do not have sufficient permissions to access this page.
I think the error was on the custom capability but I have no idea on how to fix it. please help.