Hi all,
Does anybody know of an easy way to clear out old user accounts which are older than a certain date? I can't seem to find any mechanism any where.
Thanks,
Stuart Anderson, University of Manchester.
There isn't one, that I'm aware of. I wouldn't rush into it. Many of your tables are much larger than the mdl_user one, so your performance isn't suffering. It's hard to define a cast-iron ex-user; students return as postgrads, the teacher who left gets a new contract, the committee voted out of existence gets revived.
The existing Delete tag in Edit Users just sets a flag to deleted, as far as I know, so the user doesn't show up in lists. You could do the same sort of thing with something like
update mdl_user set deleted=1 where currentlogin<date_3_months_ago;
where date_3_months_ago is a Unix date - but please test it somewhere harmless first.
If you just want to stop ex-students nosing around open courses, I would instead check periodically to make sure all your enrolment keys are set.
The existing Delete tag in Edit Users just sets a flag to deleted, as far as I know, so the user doesn't show up in lists. You could do the same sort of thing with something like
update mdl_user set deleted=1 where currentlogin<date_3_months_ago;
where date_3_months_ago is a Unix date - but please test it somewhere harmless first.
If you just want to stop ex-students nosing around open courses, I would instead check periodically to make sure all your enrolment keys are set.