SQL for fetching users with view capability needed

Re: SQL for fetching users with view capability needed

by Tim Hunt -
Number of replies: 0
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Normally you don't need to bother about the SQL for this. Instead you can use the functions in accesslib.php. Something like:

$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$users = get_users_by_capability($context, 'mod/form:view');