phpBB 3.x – Login with e-mail address

Today, I upgraded my phpBB forum board to the latest version, and with that I lost some previous plugins and configuration. I tried to find a supported plugin to be able to login with e-mail address (as i somehow managed to do prior to the upgrade), but without success. However it turned out to be really, really simple to fix it yourself.

How-to:

Open /phpbb_root/phpbb/auth/provider/db.php and search for $username_clean = utf8_clean_string($username);. Just below that, make sure the SQL query looks like this instead:

$sql = 'SELECT *
FROM ' . USERS_TABLE . "
WHERE user_email = '" . $this->db->sql_escape($username_clean) . "' OR username_clean = '" . $this->db->sql_escape($username_clean) . "'";

That’s it! You can now login with your e-mail address (note that username is still accepted – otherwise you won’t be able to login to the ACP).

EDIT: I just updated my forum to version 3.2 and this little trick still works exactly the same.

1 thought on “phpBB 3.x – Login with e-mail address”

Leave a Reply

Your email address will not be published. Required fields are marked *