X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Use E-mail address instead of username 3.5.x & 4.0 (https://forum.x-cart.com/showthread.php?t=8809)

B00MER 08-05-2004 08:26 PM

Use E-mail address instead of username 3.5.x & 4.0
 
Use E-mail address instead of username for X-Cart 3.5.x & 4.0.

Let users use either their email address or username to login instead of JUST the username.

Edit include/login.php find:

Code:

$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE login='$username' AND usertype='$usertype' AND status='Y'");

Change to:

Code:

$user_data=func_query_first("select * from $sql_tbl[customers] where (login='$username' or email='$username') and usertype='$usertype' and status='Y'");

:!: Should work without troubles on 3.5.x and 4.0.x

groovico 08-06-2004 04:59 AM

You little beauty I was just about to start looking into this! :D

Nice one boomer.

sstillwell@aerostich.com 08-06-2004 06:31 AM

Rock on!!

Works for me.

This should be standard. Most other places just use your email as the unique username, xcart should too.

mizzlewillz 08-10-2004 08:01 AM

This is a nice little mod that should be implemented into x-cart. One question , it has probably been answered before, but how would you check to see if an e-mail address already exists and stop another person from registering an identical e-mail address. I am figuring it is somewhere in include/register.php, but can't seem to locate the where and what type of code to add.

Thanks for any comments.

-Mike W.

1320AutoSports 08-10-2004 08:10 AM

Thanks BOOMER,

If you were a leg, and I was a dog... well you get the point..

Awesome mod

B00MER 08-10-2004 08:13 AM

Quote:

Originally Posted by mizzlewillz
One question , it has probably been answered before, but how would you check to see if an e-mail address already exists and stop another person from registering an identical e-mail address.


Go into phpMyAdmin and set the email field to "Unique" and MySQL will take care of it for you ;) OR login to X-Cart and use the following MySQL code snippet in the Patch SQL area:

Code:

ALTER TABLE `xcart_orders` ADD UNIQUE (
`email`
);
ALTER TABLE `xcart_customers` ADD UNIQUE (
`email`
);


You may need to add some error catching in include/register.php but atleast noone can register the same email twice.

PhilJ 08-13-2004 05:51 AM

Slight addition which adds a checkbox to copy the e-mail field to the username field.

in skin1/check_email_script.tpl add the following code:

Code:

{* COPY E-MAIL AS USERNAME MOD *}

{literal}
<script language="JavaScript1.2">

var uname = "";

function InitSaveVariables(form) {
uname = form.uname.value;
}

function copyemail(form) {
if (form.copy.checked) {
InitSaveVariables(form);
form.uname.value = form.email.value;
}

else {
        form.uname.value = uname;
        }
}

</script>
{/literal}


then in skin1/main/register_account.tpl just below the comment

Code:

{* NOT anonymous account *}

add this code:

Code:

{if $userinfo.login ne "" || ($login eq $userinfo.uname && $login ne '')}
{else}
<TR>
<TD align="right"></TD>
<TD></TD>
<TD nowrap>
<input type="checkbox" name="copy" onclick=javascript:copyemail(this.form);>Use E-Mail Address as Username
</TD>
</TR>
{/if}


richard9977 09-05-2004 08:06 AM

Add this to get it to work...
 
{/if}

:D

nfc5382 09-08-2004 05:05 PM

thanks!

TWS Accessories 03-13-2005 07:43 PM

Good job! I have to use this ASAP on my sites. thanks!


All times are GMT -8. The time now is 05:41 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.