Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

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

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 08-05-2004, 08:26 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default 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
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #2  
Old 08-06-2004, 04:59 AM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

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

Nice one boomer.
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
  #3  
Old 08-06-2004, 06:31 AM
 
sstillwell@aerostich.com sstillwell@aerostich.com is offline
 

eXpert
  
Join Date: Jun 2004
Location: Duluth, MN
Posts: 242
 

Default

Rock on!!

Works for me.

This should be standard. Most other places just use your email as the unique username, xcart should too.
__________________
No longer using Xcart, was good while it lasted.
Reply With Quote
  #4  
Old 08-10-2004, 08:01 AM
 
mizzlewillz mizzlewillz is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 45
 

Default

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.
Reply With Quote
  #5  
Old 08-10-2004, 08:10 AM
 
1320AutoSports 1320AutoSports is offline
 

Advanced Member
  
Join Date: Apr 2003
Posts: 89
 

Default

Thanks BOOMER,

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

Awesome mod
Reply With Quote
  #6  
Old 08-10-2004, 08:13 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

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.
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #7  
Old 08-13-2004, 05:51 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default

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}
__________________
xcartmods.co.uk
Reply With Quote
  #8  
Old 09-05-2004, 08:06 AM
 
richard9977 richard9977 is offline
 

Newbie
  
Join Date: Apr 2004
Posts: 1
 

Default Add this to get it to work...

{/if}

Reply With Quote
  #9  
Old 09-08-2004, 05:05 PM
 
nfc5382 nfc5382 is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 477
 

Default

thanks!
__________________
-----------------------
x-cart v4.7.6 [LIVE]
x-cart v4.0.18 [retired 2004-2016]
x-cart v3.5.13 [retired]
x-cart v3.4.14 [retired]
Reply With Quote
  #10  
Old 03-13-2005, 07:43 PM
 
TWS Accessories TWS Accessories is offline
 

eXpert
  
Join Date: Sep 2004
Posts: 236
 

Default

Good job! I have to use this ASAP on my sites. thanks!
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:09 AM.

   

 
X-Cart forums © 2001-2020