We have get_enrolled_users and count_enrolled_users functions in Moodle, both functions have a $onlyactive parameter which is currently discarding suspended user enrolments, but returning/counting suspended users. $onlyactive param documentation states that consider only active enrolments in enabled plugins and time restrictions; the Suspended account user attribute help states that Suspended user accounts cannot log in or use web services, and any outgoing messages are discarded., so it seems that both suspensions have a different purpose.
I have detected a couple of curious cases:
- Grader report - Show only active enrolments setting: Users suspended by an admin appears there even though this setting is enabled, this setting only affects enrolment suspensions
- Assignment grading page: The same, users suspended by an admin appears in the users list, if you apply a course enrolment suspension then the user does not appear any more
I've created an issue for this (MDL-49455) I am commenting about it here to reach a bigger audience in case I am missing something and these are expected behaviours or someone has an argument about changing this behaviour so suspended users do not appear in the gradebook nor in the assign grading page (there are the two main cases I detected but there could be more). Linking the only MDocs page I've found about "suspensions" (https://docs.moodle.org/28/en/Unenrolment#Suspended_or_Unenrolled.3F) for what I understand it is considering both suspensions the same.
Thinking on a suspended user use case, an institution may be interested in suspending a user (until he pays the enrolment taxes for example) so he can not log in into the system but teachers should be able to grade the user in the meanwhile, if the enrolment is suspended for the same reason it appears there....