A while back, I reported something in the tracker that I think can be easily fixed. I supply the code that will fix the problem.
So far, after 6 months, it hasn't made it into the Moodle core code, and no one has commented on the issue.
So I'm wondering if I've tagged it wrong by version or status or something... In the grand scheme of things, this is a minor issue, but for individual moodle sites, it can be a major problem, involving the corruption of data in the mdl_users table.
Can someone take a look at this?