Hey,
Quote:
passing to 4.0.14 any code changes? icon_sad.gif
updated and all my custom work fly away closed to shop to fix them out icon_sad.gif
for example register.php in root is different on 4.0.14 icon_sad.gif
|
Sorry to hear that you are having trouble. I hoped you made a backup before applying this mod. As I indicated in your pm, this mod is only tested for 4.0.13 and NOT for 4.0.14. I guess there are some differences in the register code which may make this mod incompatible. Anyway, I will send you another pm regarding this.
Now, as promised, I will post the updated code tested with 4.0.13 below. There was a bug in the dupliate email check when doing an update in the include/register. It is fixed in the updated code. I also will post some changes to templates such as recover password, profile modified etc... to show the email address instead of the auto generated username id. Hopefully, this update should be the last one as I have tested it extensively with 4.0.13. If you find any problems, please let me know. Thanks.
--- /include/register.php v3.mod2
Code:
# mod2
# find original code snippet
if (!(@$uerror || @$eerror || @$fillerror || @$error)) {
#
# Fields filled without errors. User registered successfully
#
$crypted = addslashes(text_crypt($passwd1));
# end original code snippet
# replace modified code snippet
# mod.use.email.rather.username
if(!$fillerror) {
# check if email already exist in customers table
$email = strtolower($email);
$email_on_record = func_query_first_cell("select email from $sql_tbl[customers] where email='$email'");
if( $email == $email_on_record) {
# duplicate email not allowed
$eerror = true;
}
# exception checks to this rule
if( $mode != "update") {
# check if this is anonymous registration during checkout
if( $eerror && func_query_first_cell("select status from $sql_tbl[customers] where email='$email' and usertype='C'") == 'A' ) {
# delete this record since the user is anonymous requesting the same email
# we can't assume that the email belongs to the user, but at least this way
# the original user can use his/her same email to register again anonymously during another checkout
# if an anonymous user already placed an order with this email, it will not effect the order information
# since it is a seperate record in the orders table
# note, if the user is already registered, we will never allow to automatically delete the registered user's record
db_query("DELETE FROM $sql_tbl[customers] WHERE login LIKE '$like_anonymous_username_prefix' AND email='$email' AND usertype='C' AND status='A'");
# this is not an error since we have deleted this record
$eerror = false;
}
}
else {
// update mode
if( $email == func_query_first_cell("select email from $sql_tbl[customers] where login='$login'")) {
# email match, user did not change email
$eupdate = false;
# this is not an error since the existing email belong to this user
$eerror = false;
}
else {
# email does not match, see if new requested email is taken (duplicate email check above)
if( !$eerror )
$eupdate = true;
}
}
} // mod.use.email.rather.username
if (!(@$uerror || @$eerror || @$fillerror || @$error)) {
#
# Fields filled without errors. User registered successfully
#
$crypted = addslashes(text_crypt($passwd1));
# end modified code snippet
--- /include/help.php
Code:
# find original code snippet
#
# Recover password
#
if ($REQUEST_METHOD=="POST" and $action=="recover_password") {
$accounts = func_query("select login, password, usertype from $sql_tbl[customers] where email='$email' and status='Y'");
# end original code snippet
# replace modified code snippet
#
# Recover password
#
if ($REQUEST_METHOD=="POST" and $action=="recover_password") {
# mod.use.email.rather.username, replace login with email into accounts
$accounts = func_query("select email, password, usertype from $sql_tbl[customers] where email='$email' and status='Y'");
# end modified code snippet
--- /skin1/help/contactus.tpl
Code:
{* find original code snippet *}
<TR valign="middle">
<TD class="FormButton">{$lng.lbl_username}</TD>
<TD></TD>
<TD nowrap>
<INPUT type="text" id="uname" name="uname" size="32" maxlength="32" value="{$userinfo.login}">
</TD>
</TR>
{* end original code snippet *}
{* replace modified code snippet *}
{* mod.use.email.rather.username, username not needed anymore *}
{if 0}
<TR valign="middle">
<TD class="FormButton">{$lng.lbl_username}</TD>
<TD></TD>
<TD nowrap>
<INPUT type="text" id="uname" name="uname" size="32" maxlength="32" value="{$userinfo.login}">
</TD>
</TR>
{/if}
{* end modified code snippet *}
* Note: You can delete the code inside the {if 0}{/if} block since smarty will never execute it. It is there for reference only.
--- /skin1/mail/html
Code:
{* find original code snippet *}
<TD><TT>{$accounts[acc_num].login}</TT></TD>
{* end original code snippet *}
{* replace modified code snippet *}
{* mod.use.email.rather.username, show email instead *}
<TD><TT>{$accounts[acc_num].email}</TT></TD>
{* end modified code snippet *}
--- /skin1/mail/html/profile_data.tpl
Code:
{* find original code snippet *}
<TD width="80%"><TT>{$userinfo.login}</TT></TD>
{* end original code snippet *}
{* replace modified code snippet *}
{* mod.use.email.rather.username, show email instead *}
<TD width="80%"><TT>{$userinfo.email}</TT></TD>
{* end modified code snippet *}
------- The following changes below are completely optional. It changes the s the username to email for order export on regular csv or quickbooks. Just follow the instructions in the comment to make the change to the file.
--- /skin1/main/orders_export.tpl
{* mod.use.email.rather.username, replaced all $orders[oid].login with $orders[oid].email *}
--- /skin1/modules/QuickBooks/orders_export_qb.tpl
{* mod.use.email.rather.username, replaced all $orders[oid].login with $orders[oid].email *}
~x-light