Quantcast
Channel: General developer forum
Viewing all articles
Browse latest Browse all 37673

Re: Number of participants code

$
0
0
by Darko Miletić.  

Query for this :

SELECT COUNT(DISTINCT ra.userid)
FROM
mdl_role_assignments ra,
mdl_context ct,
mdl_config mc,
mdl_user u
WHERE
ra.contextid = ct.id
AND
ra.userid = u.id
AND
u.deleted = 0
AND
mc.name = 'gradebookroles'
AND
ra.roleid IN (mc.value)
AND
ct.contextlevel = 50
AND
ct.instanceid = <my course id>

If you want to use standard Moodle API from PHP code than you have this:

get_users_from_role_on_context but it does not do all of the checks as the above query does.


Viewing all articles
Browse latest Browse all 37673

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>