One of my upcoming projects is an intranet. For many reasons, I have chosen to use BuddyPress as the starting point and customize it for specific needs.
One such need is a restriction on which email address domains can be used to register a user. For instance, if I were to create such a system for old.webit.ca, I would want only users with a @old.webit.ca email address to register. Anyone else would simply not be allowed.
After some digging around, it seemed like there was no plugin that would quickly do what I was looking for. There were options, but most felt complicated or hacks. That is, until I found the following line in bp-core-signup.php:
// in function bp_core_validate_user_signup $limited_email_domains = get_site_option( 'limited_email_domains', 'buddypress' );
Great! All that is left is a quick plugin to populate ‘limited_email_domains’.
<?php /* Plugin Name: Restricted Email Domains Description: Restricts registration user email addresses to @old.webit.ca */ add_option('limited_email_domains', array('old.webit.ca'));
Activate the plugin and you’re good to go.