My experience with groups is this...if you have someone in a group and you unenroll them, regardless of method, they are removed from the group and the grades disappear. If you re-enroll them and convince it to restore grades, the group is not reinstated.
I saw in cohort documentation that students could be assigned to cohorts through user upload process https://docs.moodle.org/29/en/Upload_users and this works great. What we need to do in our organization is programmatically remove user from one cohort and add to another cohort.
For example our cohorts are defined for departments and if an user changes departments - move from HR department to Accounting department , he will need to be added to all the courses where he was enrolled through cohort sync with HR cohort (to still have his grades available for reporting etc, ) and then need to be added to accounting cohort. Is there an utility to do this or would this be achieved only through sql table inserts/updates.
Thanks
Interesting. I am planning to manage cohorts through LDAP (see "Is LDAP enrollment also groups/groupings/cohorts capable?" https://moodle.org/mod/forum/discuss.php?d=324567). But the behaviour discussed here would be a major obstacle.