MyBB Community Forums

Full Version: Preventing Multiple Registrations With Same Email
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I often have problems on my board where someone will register multiple accounts using the same e-mail address. I would think MyBB would have a feature to prevent this, but there only seems to be an option for IPs.

Is there a way to prevent multiple registrations with the same email address?
Open member.php
Find:
	if(!preg_match("/^(.+)@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si", $email) && !$bademail)
	{
		$errors[] = $lang->error_invalidemail;
	}

Add after:
$emailresult = $db->query("SELECT username FROM ".TABLE_PREFIX."users WHERE email='".addslashes($email)."' LIMIT 1");
if($db->num_rows($emailresult) > 0)
{
$existinguser = $db->fetch_array($emailresult);
$errors[] = "$existinguser[username] already has registered with the same email address.  Please choose another one.";
}

(Untested code, please let me know if it works or not)
will this work for rc4 as well ?
Why not upgrade? Confused . I don't use RC4. Long time since. But you can test it tho and see if it works. But I would recommand to upgrade to PR 2.
i did and it works. i will upgrade when newer version comes out. no time to create new themes reeinstall mods plugins etc
Newer version will only include bugfixes, so your themes should work if you make new ones now.
Cool, hope this is built into the gold release
Here's a plugin that should do the same as the code I posted above. I haven't tested it so it would be nice if someone let me know if it works or not Big Grin
I just installed the plugin and it seems to be working well.