Prevent Users from Updating Their Profile Email Address

I’m trying to find a way to prevent users from updating or adding an email address using the $IS_ADMIN function. Below are the variables:

  • users are in their own User roles within a properly configured Security Group
    -right now they can view/edit/delete their profile email address plus add other email addresses
  • I’d like to use the $IS_Admin function to prevent them from making any email address changes (only an admin should be able to do this)

In a user’s account, I’ve been able to use the $IS_Admin to only show their Username, status and user type without allowing changes. They can also only view the Reports To field and not re-assign to another user. This way they can freely update their contact info with all the associated php files in the Custom folder for future-proofing.

The coding for the Email Settings portion of their profile doesn’t exist in any of the list, edit or detail view.php files (unless I’ve missed it somehow).

Can anyone direct me on this? Many thanks.

you can modify the TPL used to display the Email field. By looking at the modules/Users/metadata/editviewdefs.php you can see that there is a footer tpl file defined as
'footerTpl'=>'modules/Users/tpls/EditViewFooter.tpl',

you can customise these two files and setup your own logic to not display email field to Non admins

Thank you, cherub-chum
I’ll see if I can work this out

maybe you can help me with this next issue.

I’m trying to set the Account Number field to read only for non Admins. I added the following code to \custom\modules\accounts\metadata\detailviewsdef.php but the Account Number field still shows as being editable in the Account’s detail view. I successfully changed the EditView to show the account number as read only for non-Admins but can’t figure out how to change the DetailView screen to read only.
This is how my detailviewdefs.php starts:

<?php $viewdefs ['Accounts'] = array ( 'DetailView' => array ( 'templateMeta' => array ( 'form' => array ( 'buttons' => array ( 0 => 'EDIT', 1 => 'DUPLICATE', 2 => 'DELETE', 3 => 'FIND_DUPLICATES', 'AOS_GENLET' => array ( 'customCode' => '', ), ), ), 'maxColumns' => '2', 'widths' => array ( 0 => array ( 'label' => '10', 'field' => '30', ), 1 => array ( 'label' => '10', 'field' => '30', ), ), 'includes' => array ( 0 => array ( 'file' => 'modules/Accounts/Account.js', ), ), 'useTabs' => false, 'tabDefs' => array ( 'LBL_ACCOUNT_INFORMATION' => array ( 'newTab' => false, 'panelDefault' => 'expanded', ), 'LBL_EDITVIEW_PANEL1' => array ( 'newTab' => false, 'panelDefault' => 'expanded', ), 'LBL_PANEL_ADVANCED' => array ( 'newTab' => false, 'panelDefault' => 'collapsed', ), ), 'syncDetailEditViews' => true, ), 'panels' => array ( 'lbl_account_information' => array ( 0 => array ( 0 => array ( 'name' => 'name', 'comment' => 'Name of the Company', 'label' => 'LBL_NAME', ), 1 => array( 'name' => 'account_number', 'comment' => 'The client account number', 'label' => 'Account_Number', 'type' => 'readonly', 'customCode' => '{if $IS_ADMIN}@@FIELD@@{else}{$fields.account_number_c.value}{/if}', ), /* 1 => array ( 'name' => 'account_number_c', 'label' => 'LBL_ACCOUNT_NUMBER', ), */ etc Thanks again for your help - greatly appreciated.