Not sure why this wasn’t in core! or why there’s been so much faffing around on this topic when your solution looks pretty straightforward!
An issue as I see it is to some extent nomenclature what is a ‘Domain’? is a domain ‘example.com’ or ‘.com’ the answer ought to be that they both are or at least one is a TLD which to my minnd is still a ‘domain’
One possible fault with this issue appears to me to lie with the wording of the WP/MPMU – > WPMS options for limited and banned emails ; we have for Limited domains ‘ If you want to limit site registrations to certain domains. One domain per line. ‘ so I figure I’ll add .’com’ now the only registrations I will accept are from emails addresses residing in that domain space, but this doesn’t work and any email addies such as ‘joeuser @example.com’ are blocked. So ‘Limited email domains’ is just that limited to full domains and as such not greatly useful, there are many domains in existence how do I know which I want to allow, this limiting only suits something like a corporate environment where you definitely knew you only wanted registrations from your own domain or a limited few others.
Far far more useful would have been if this was a white list and allowed you to set TLDs and then perhaps further block specific domains within that TLD.
At the moment with your script I think there’s an issue? If you have set a domain in ‘limited’ then that will overrule a banned domain your script is voided, which may be fine under the circumstances.
Remove the ‘limited’ entry and your script appears to work fine, thanks for working a solution up; sadly though it’s a matter of hacking core files which isn’t good.
Can you add this as a Trac ticket patch/enhancement for 1.3 please then it may get added to core.