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
  #91  
Old 09-03-2007, 11:10 AM
 
Plasticsteak1 Plasticsteak1 is offline
 

Newbie
  
Join Date: Jun 2007
Posts: 2
 

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

It's been a while since I made these changes.. but if I remember correctly I had to change the registration template a little bit by increasing the size of the input field for username(email address) on the registration page. I also found out later that I had to increase the size of the username field in the mySQL database.

~T
__________________
~Plasticsteak1
Reply With Quote
  #92  
Old 01-01-2008, 07:26 PM
 
rhu rhu is offline
 

Advanced Member
  
Join Date: Dec 2007
Posts: 63
 

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

Has this been successfully applied to 4.1.9 ?

I noticed some users have been successful using post #64 for 4.1.3.

I want to give this a whirl in 4.1.9, but here are some of my concerns:

1. 'username' is VARCHAR(32) and it was noted in post #70 that there's a possibility of emails having more characters than that. (can this be fixed in phpMyAdmin by making 'username' have the same # of characters as 'email'?)

2. Post #85 notes that if you make 'email' unique in the DB, you get an sql error when user tries to place another order. Can this be confirmed or is there a fix for this?
__________________
X-Cart 4.3.0 Gold
Reply With Quote
  #93  
Old 01-20-2008, 09:09 AM
  ShishaPipeUK's Avatar 
ShishaPipeUK ShishaPipeUK is offline
 

Senior Member
  
Join Date: Jul 2005
Location: London, England.
Posts: 118
 

Thumbs up Re: Use E-mail address instead of username 3.5.x & 4.0

Quote:
Originally Posted by dsoong
This is quick work around I have


I don't know if your code will work the same. I am trying to fix a utf-8 user name problem I having so my code has change quite a bit.

Thanks for the code, works great. I have had a few phone calls saying they cant modify there customer account details so i have been doing this in admin for them, but now i put in the code below

Code:
$email = strtolower($email); if (!isset($uname)) $uname = strtolower($email);

you supplied in the include/register.php section and now the customer can change there details withiout the access denied.

Just wanted to say thanks.
__________________
Apache/2.0.55 (Red Hat) & MYSQL Server: 5.0.24
PERL: 5.008005 / PHP: 4.4.4 - 4.3.1 X-CART

Shop carts at
http://www.nightscene.co.uk/shop/home.php
http://www.theshisha.net/shopcart/home.php
http://www.system-maintenance.com/maint/home.php
http://www.tabac4u.com
Reply With Quote
  #94  
Old 03-24-2008, 05:01 AM
 
toolexperts toolexperts is offline
 

eXpert
  
Join Date: Feb 2008
Location: Knoxville, TN
Posts: 289
 

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

Quote:
Originally Posted by xcell67
Hi,

I'm going to throw in my method for 4.1.0 rc4 in case some couldn't get the others to work.

include/register.php

find

Code:
$fillerror = (empty($uname) || !empty($error) || empty($passwd1) || empty($passwd2) || ($passwd1 != $passwd2));

replace with

Code:
$fillerror = (!empty($error) || empty($passwd1) || empty($passwd2) || ($passwd1 != $passwd2));

By deleting the error check for username, the cart will allow registrations without it.



Find
Code:
if (!@$error && $current_area == "C" && $active_modules["UPS_OnLine_Tools"]) {

Replace with
Code:
if (empty($uname)) $uname = $email; if (!@$error && $current_area == "C" && $active_modules["UPS_OnLine_Tools"]) {

Since we're not allowing the customer to enter a username, the code above will automatically populate the username field with the email the customer supplies.

Find
Code:
$profile_values['email'] = $email;

Replace with
Code:
$profile_values['email'] = $email; $profile_values['login'] = $email;

When the customer updates their email, their login will also reflect the change. There's only a slight problem with this. If the customer updates any of their other information, everything is fine. But when they update their email, they will get logged out. I don't know what causes the logout but their email/login still gets changed. What I did for my cart was add a little note "Note: If you change your email address, you will have to re-login for security purposes"

skin1/generate_required_fields_js.tpl

Delete this code to prevent check for uname

Code:
["uname", "{$lng.lbl_username|strip|replace:'"':'\"'}"],


skin1/main/register_account.tpl

You'll need to comment out the username fields:

Code:
{* Anonymous account *} {* <tr> <td align="right">Email Address</td> <td></td> <td nowrap="nowrap"> <input type="text" name="uname" size="32" maxlength="32" value="{$userinfo.login}" /> </td> </tr> *}

Code:
{* NOT anonymous account *} {*<tr> <td align="right">Email Address</td> <td class="Star">*</td> <td nowrap="nowrap"> {if $userinfo.login ne "" || ($login eq $userinfo.uname && $login ne '')} {$userinfo.login|default:$userinfo.uname} {else} <input type="text" id="uname" name="uname" size="32" maxlength="32" value="{if $userinfo.uname}{$userinfo.uname}{else}{$userinfo.login}{/if}" /> {if ($reg_error ne "" and $userinfo.uname eq "" and $userinfo.login eq "") or $reg_error eq "U"}<font class="Star">&lt;&lt;</font>{/if} {/if} </td> </tr> *} <input type="hidden" name="uname" value="{$userinfo.login|default:$userinfo.uname}" />

With the above code, I had to take <input type="hidden" name="uname" value="{$userinfo.login|default:$userinfo.uname}" /> out of the commented out code block because xcart needs it to finish the registration process. You can leave everything else commented out.


All of the above satisfies your needs if you want the customer to use their email as their login. The extra stuff below will add in a second field for them to type their email twice for confirmation:

skin1/main/register_contact_info.tpl or wherever tpl you have your email field in

Add this under the intial email block:

Code:
<TR> <TD align="right">Retype Email</TD> <TD><font class=Star>*</font></TD> <TD nowrap> <input type="text" id="emailtwo" name="emailtwo" size=32 maxlength=128 value="{$userinfo.email}"> </TD>

skin1/check_email_script.js
Add this:

Code:
if(document.registerform.emailtwo) { if(field.value==document.registerform.emailtwo.value){ } else{ alert("Please reconfirm your email address. It does not match."); document.registerform.emailtwo.focus(); document.registerform.emailtwo.select(); err = true; } }

before return !err; at the end of the file

</TR> [/code]


Just freaking great.....Parse error: syntax error, unexpected T_BOOLEAN_OR in /home/httpd/vhosts/toolexperts.com/httpdocs/register.php on line 201
__________________
Tool Experts
X-Cart DB Version: 4.1.12 GOLD
Reply With Quote
  #95  
Old 03-24-2008, 06:26 AM
 
toolexperts toolexperts is offline
 

eXpert
  
Join Date: Feb 2008
Location: Knoxville, TN
Posts: 289
 

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

ok got it restored
__________________
Tool Experts
X-Cart DB Version: 4.1.12 GOLD
Reply With Quote
  #96  
Old 03-24-2008, 11:18 AM
 
toolexperts toolexperts is offline
 

eXpert
  
Join Date: Feb 2008
Location: Knoxville, TN
Posts: 289
 

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

can someone help me? I restored my file back and i still get a message that there is an unexpected = in line 201....and this also occurs when attempting to checkout...

}
$fillerror (!empty($error) || empty($passwd1) || empty($passwd2) || $passwd1 ! $passwd2 || strlen($passwd1) > 64 || strlen($passwd2) > 64);

if (!$fillerror) {
if ($default_fields['b_country']['avail'] != 'Y') {
$b_country = $config['General']['default_country'];
if ($default_fields['s_country']['avail'] != 'Y')
$s_country = $config['General']['default_country'];
}
__________________
Tool Experts
X-Cart DB Version: 4.1.12 GOLD
Reply With Quote
  #97  
Old 03-25-2008, 05:04 AM
 
toolexperts toolexperts is offline
 

eXpert
  
Join Date: Feb 2008
Location: Knoxville, TN
Posts: 289
 

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

Quote:
Originally Posted by B00MER
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


I implemented this mod in 4.1.8, however, when I try to login, it tells me to contact the site admin as my account is temporarily disabled, and I can't seem to create new accounts
__________________
Tool Experts
X-Cart DB Version: 4.1.12 GOLD
Reply With Quote
  #98  
Old 03-25-2008, 05:35 AM
 
toolexperts toolexperts is offline
 

eXpert
  
Join Date: Feb 2008
Location: Knoxville, TN
Posts: 289
 

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

Do any of these methods work in 4.1.8?
__________________
Tool Experts
X-Cart DB Version: 4.1.12 GOLD
Reply With Quote
  #99  
Old 05-08-2008, 12:59 AM
 
4worx.com 4worx.com is offline
 

Newbie
  
Join Date: Feb 2008
Posts: 3
 

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

Did somebody found a way to get the e-mail login working in 4.1.9? I have been trying to get it working but with little succes. I only get the message the account has been disabled by the admin. Any (quick) fix on top of all the suggestions here?
__________________
http://www.4worx.com

X-Cart Gold version: 4.1.9
Reply With Quote
  #100  
Old 05-08-2008, 04:52 AM
 
toolexperts toolexperts is offline
 

eXpert
  
Join Date: Feb 2008
Location: Knoxville, TN
Posts: 289
 

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

the only way I made this work, was to change all references to for username to email address by using the template editor, then when i was importing i used the email address as the username. This is worling great at my site the only issue i have is i need to enable it so that an email with longer than 32 chracters can login, but noone has replied to my other post.
__________________
Tool Experts
X-Cart DB Version: 4.1.12 GOLD
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 02:06 AM.

   

 
X-Cart forums © 2001-2020