zainyaqoob Posted February 7, 2017 Share Posted February 7, 2017 Hi, I am using WHMCS, While users register account at our website their are form fields which become non-editable after registration, there is option in WHMCS admin panel which allow you to select which fields you wanted to make Non-Editable, But if we create some custom fields there is no option in whmcs to make that custom fields Non-Editable, that fields remain editable after registration, I need a way to prevent clients from editing custom fields the fields which I create new. I attahed the screen shot of WHMCS admin option for more to understand. 0 Quote Link to comment Share on other sites More sharing options...
vbatra Posted February 7, 2017 Share Posted February 7, 2017 You need a custom template with these fields included and locked/disabled 0 Quote Link to comment Share on other sites More sharing options...
WHMCS ChrisD Posted February 8, 2017 Share Posted February 8, 2017 Hi Zainyaqoob, Whilst it isn't possible to set this up on the custom fields a custom template may acheive this as Vbatra has outlined i'd also recommend adding a feature request for the team to consider in the future. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 8, 2017 Share Posted February 8, 2017 surely you could just add 'readonly' to the customfields input form fields in the template - it's a minor template edit. 0 Quote Link to comment Share on other sites More sharing options...
erickandrade Posted April 10, 2017 Share Posted April 10, 2017 There is a module called INPUT RED made by WHMCS.RED 0 Quote Link to comment Share on other sites More sharing options...
ambaha Posted January 7, 2022 Share Posted January 7, 2022 (edited) in your template edit this file: clientareadetails.tpl add this code: <script type="text/javascript"> $(function() { $("#customfieldXX").attr("readonly", "readonly"); });</script> Replace customfieldXX with your customfiled address like: customfield44 for prevent to Bypass the code add file whit this name: PreventChangesToClientCustomFields.php in includes/hooks <?php use WHMCS\Database\Capsule; add_hook('CustomFieldSave', 1, function($vars) { $ReadOnlyFields = array('43', '63'); // IDs of Custom Fields that cannot be edited $DisallowAdmin = false; // true = Even Administrators are not allowed to edit | false = Administrators can freely update Custom Fields /* Do not edit below */ $IsAdmin = (basename($_SERVER['PHP_SELF']) == 'clientsprofile.php' ? true : false); $IsNewClient = (in_array(basename($_SERVER['PHP_SELF']), array('register.php', 'cart.php')) ? true : false); if (in_array($vars['fieldid'], $ReadOnlyFields) AND (($IsAdmin AND $DisallowAdmin) OR (!$IsAdmin)) AND !$IsNewClient) { return array('value' => Capsule::table('tblcustomfieldsvalues')->where(['fieldid' => $vars['fieldid'], 'relid' => $vars['relid']])->first(['value'])->value); } }); replcae array('43', '63') with your custon filed item like: $ReadOnlyFields = array('44') Edited January 7, 2022 by ambaha 1 Quote Link to comment Share on other sites More sharing options...
sokalsondha Posted July 1 Share Posted July 1 On 4/10/2017 at 4:17 AM, erickandrade said: There is a module called INPUT RED made by WHMCS.RED I have used that. but its not working in version 8. and the developer website down too. do you know that developer? thanks 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.