MyBB Community Forums

Full Version: How can I login with phone number?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I need the users can be loged with the username or with a phone number
I added the column "phone" in mybb_users table

But in PHP How can i do?

Can I use the  loginhandler class?

Or is better idea, get the username with the phone
			$query = $db->simple_select("users", "username", "phone = '{$phone}'", array('limit' => 1));
			$usuario=$db->fetch_field($query, 'username');
		$plugins->run_hooks("member_do_login_start");
		// Is a fatal call if user has had too many tries
		$errors = array();
		$logins = login_attempt_check();
		require_once "./../../../interactu.wio.mx/public_html/inc/datahandlers/login.php";
		$loginhandler = new LoginDataHandler("get");
		$user = array(
			'username' => $usuario,
			'password' => $password,
			'remember' => "yes",
			'imagestring' => ""
		);
		$user_loginattempts = get_user_by_username($user['username'], array('fields' => 'loginattempts'));
		$user['loginattempts'] = (int)$user_loginattempts['loginattempts'];
		$loginhandler->set_data($user);
		$validated = $loginhandler->validate_login();
Best regards
Hello,

I am aware MyBB allows you to have username/email logins for your users. Do you have a forum link? You can try your own loginhandler class and i can try logging in with a phone number. Honestly, it seems really risky using phone numbers via the forum as a user perspective. Hope someone with experience can help! Smile
I don't even know where to start with this as I can already see a massive security issues for your users and a lot of people not wanting to submit that information.