News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

How to prevent editing custom user fields after registration?

Started by zuwann, June 17, 2018, 14:43:01 PM

Previous topic - Next topic

zuwann

Hi,
I need to prevent editing some custom fields after registration from the buyer.
In details, in registration form i've added a user field that allows buyer to select the typology of customer (private or company). If the field is set read-only, in the registration form the buyer can select the value, but VM can not save it in user information. If the field is not read-only, the buyer can select the value during registration but at same time can change it in profile editing too. Well, I need this field can be selected during registration, but it must not be modified in profile.
At the moment I solved with a jQuery script, but I would like to solve this enigma with a more secure method.
How can i do this?

Thanks in advantage.

VirteMart 3.2.14, Joomla! 3.8.8

Studio 42

Have you try to disable the field in all form except in cart form ?
Another solution is to check if you are in cart on display user form in an override and hide the input in JOOMLAROOT\components\com_virtuemart\views\user\tmpl\edit_address_userfields.php
in the loop $field['name'] is the name of the field in the database.
<div style="display:none;"><?php $field['formcode'?></div>
Is one way to hide it.
Another solution is to do own user field plugin(vmuserfield) so you can manage display, security .. with your own rules