MyBB Community Forums

Full Version: Login with E-mail and not with username
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
today i'm working about a modification for login into the forum, this modification allows you to login with email and not with username.
In the header_welcomblock_guest I replaced this:
<!--	lang.username = "{$lang->login_username}";
with
<!--	lang.username = "Email";
and in the file functions_user.php i replaced this:
function user_exists($uid)
{
	global $db;
	
	$query = $db->simple_select("users", "COUNT(*) as user", "uid='".intval($uid)."'", array('limit' => 1));
	if($db->fetch_field($query, 'user') == 1)
	{
		return true;
	}
	else
	{
		return false;
	}
}
with this:
function user_exists($email)
{
	global $db;
	
	$query = $db->simple_select("email", "COUNT(*) as email", "email='".intval($email)."'", array('limit' => 1));
	if($db->fetch_field($query, 'email') == 1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

But they don't work Dodgy
Hello,

I have create a plugin for this. Please download the Attachment »emaillogin.php« and copy the file into inc » plugins and activate it. Smile
hmm, may I ask what are the vantages of logging in with email instead of username?
its more like vB ... like most of the requests you see here =P
I wanted create it to release it...I don't want use it Rolleyes
Why reinventing the wheel?

Also it seems that you don't have experience, you didn't understand what user_exists does exactly, did you study the code? If you look the param is an integer value and not a string...