有没有办法获取所有角色,包括(id & rolename)
function getrole {
$options = array();
foreach (role_get_names() as $myrole) {
$options[$myrole->id] = $myrole->localname;
}
return html_writer::select($options);
}发布于 2020-03-05 06:27:38
// The true at the end is used to return an array for select elements.
// So this returns an array with array(roleid => 'originalrolename')
$options = role_fix_names(get_all_roles(), context_system::instance(), ROLENAME_ORIGINAL, true);https://stackoverflow.com/questions/60281599
复制相似问题