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"><<</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]