Lock Customer Profile Details

Hello,

Is any way to lock some customer profile fields (email, name, lastname) after a customer sign in on our website?

Hello,

Is any way to lock some customer profile fields (email, name, lastname) after a customer sign in on our website?

What do you mean by "lock"? They should not be editable?

What do you mean by "lock"? They should not be editable?

Exactly, if customers need to change their email they must need to contact us and not have the ability to change the field.

Exactly, if customers need to change their email they must need to contact us and not have the ability to change the field.

To disable e-mail you need to find design/themes/YOUR_THEME/templates/views/profiles/components/profiles_account.tpl and replace this code:

{__("email")}

with this one:

{__("email")}

and clear cache.

To disable e-mail you need to find design/themes/YOUR_THEME/templates/views/profiles/components/profiles_account.tpl and replace this code:

{__("email")}

with this one:

{__("email")}

and clear cache.

Thanks it works for email field, do you know in which file can i make the same for fields like name, lastname?

design/themes/YOUR_THEME/templates/views/profiles/components/profile_fields.tpl

replace


with

{$additional_params = ''}
{if $auth.user_id}
    {if $data_id == 'firstname' || $data_id == 'lastname' || $data_id == 's_firstname' || $data_id == 's_lastname' || $data_id == 'b_firstname' || $data_id == 'b_lastname'}
        {$additional_params = "disabled=\"disabled\""}
    {/if}
{/if}

design/themes/YOUR_THEME/templates/views/profiles/components/profile_fields.tpl

replace


with

{$additional_params = ''}
{if $auth.user_id}
    {if $data_id == 'firstname' || $data_id == 'lastname' || $data_id == 's_firstname' || $data_id == 's_lastname' || $data_id == 'b_firstname' || $data_id == 'b_lastname'}
        {$additional_params = "disabled=\"disabled\""}
    {/if}
{/if}

I agree, but there is a moment: fields are still editable at the Shipping address block for some reason.

I agree, but there is a moment: fields are still editable at the Shipping address block for some reason.

Works ok for me on the local installation

design/themes/YOUR_THEME/templates/views/profiles/components/profile_fields.tpl

replace


with

{$additional_params = ''}
{if $auth.user_id}
    {if $data_id == 'firstname' || $data_id == 'lastname' || $data_id == 's_firstname' || $data_id == 's_lastname' || $data_id == 'b_firstname' || $data_id == 'b_lastname'}
        {$additional_params = "disabled=\"disabled\""}
    {/if}
{/if}

Thanks, this works fine with fields name, lastname

To disable e-mail you need to find design/themes/YOUR_THEME/templates/views/profiles/components/profiles_account.tpl and replace this code:

{__("email")}

with this one:

{__("email")}

and clear cache.

It works OK when a customer is logged in but it was a problem when someone want to register to our website the field email is not be editable too. Is any way to fix this?

It works OK when a customer is logged in but it was a problem when someone want to register to our website the field email is not be editable too. Is any way to fix this?

Please replace that code with this one:

{__("email")}

Please replace that code with this one:

{__("email")}

This works. Thank you for your help.

Please replace that code with this one:

{__("email")}

Hello again, is any way to put an if statement for fields name and lastname when they are null?

Hello again, is any way to put an if statement for fields name and lastname when they are null?


Hello again, is any way to put an if statement for fields name and lastname when they are null?

My problem is that when someone put something in his cart and then goes to checkout and check register and fill the fields email and password and click register, in the second step the fields name and lastname are not editable because {if $auth.user_id} is true. Is any way to pass this and make the fields name - lastname not editable only when the register is complete with all the fields complete?

Hello again, is any way to put an if statement for fields name and lastname when they are null?

Please replace this condition

{if $auth.user_id}

with this

{if $auth.user_id && !empty($value)}

Please replace this condition

{if $auth.user_id}

with this

{if $auth.user_id && !empty($value)}

I think now is ok.

Something else, do you know how can i put for field "phone" something to check the unique of value? Like email field work now in cscart?

app/functions/fn.users.php

Try to replace:

 $condition = db_quote(" (?p ?p) ", (!empty($user_data['email']) ? db_quote('email = ?s', $user_data['email']) : '0'), (empty($user_data['user_login']) ? '' : db_quote(" OR user_login = ?s", $user_data['user_login'])));

with

 $condition = db_quote(" (?p ?p ?p) ", (!empty($user_data['email']) ? db_quote('email = ?s', $user_data['email']) : '0'), (empty($user_data['user_login']) ? '' : db_quote(" OR user_login = ?s", $user_data['user_login'])), (empty($user_data['phone']) ? '' : db_quote(" OR phone = ?s", $user_data['phone'])));

(!) Not tested

app/functions/fn.users.php

Try to replace:

 $condition = db_quote(" (?p ?p) ", (!empty($user_data['email']) ? db_quote('email = ?s', $user_data['email']) : '0'), (empty($user_data['user_login']) ? '' : db_quote(" OR user_login = ?s", $user_data['user_login'])));

with

 $condition = db_quote(" (?p ?p ?p) ", (!empty($user_data['email']) ? db_quote('email = ?s', $user_data['email']) : '0'), (empty($user_data['user_login']) ? '' : db_quote(" OR user_login = ?s", $user_data['user_login'])), (empty($user_data['phone']) ? '' : db_quote(" OR phone = ?s", $user_data['phone'])));

(!) Not tested

I try this but it not working.

Do you use phone in the contact information or address section?

Do you use phone in the contact information or address section?

I use phone in the billing and shipping section.