Membership Plugin - Can a user login with email and user name?

Re: [meg] Membership Plugin - Can a user login with email and user name?

Hi Meg,

This is fairly straightforward to do, but it involves modifying a core file in CMS Builder, so be careful when making the changes, or you could break your CMS Builder log-in area. It will also mean that users can log into the CMS Builder area using there e-mail address as well.

If open the file cmsAdmin/lib/login_functions.php, around line 108 you should see this line:

$query .= " FROM `$accountsTable` WHERE username = '" .mysql_escape(@$_SESSION['username']). "' LIMIT 1";

if you change it to this:

$query .= " FROM `$accountsTable` WHERE username = '" .mysql_escape(@$_SESSION['username'])."' OR email = '".mysql_escape(@$_SESSION['username'])."' LIMIT 1";

If your not using the default accounts table to store your members details in, make sure that it has an e-mail field called email.

Let me know if you run into any problems.

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com