1

I'm trying to add an option to disable the display of nickname in the setting preferences. The checkbox is appearing but it doesn't work, when the option is not checked the nickname field shouldn't appear in the contact. I added the option value with Apiv4.

btw Surnom = Nickname enter image description here enter image description here

1 Answer 1

1

You might also need to use hook_civicrm_buildForm in an extension to override what's happening in CRM/Contact/Form/Edit/Individual.php, e.g. check the value of your setting something like this but less goofy, and then remove the nick_name field from the form.

8
  • Is there no way to modify CRM core? Nicknames are more used in the Anglo-saxon world then elsewhere. having a checkbox in display preferences just like 'other firstname' would be great. We could handle this PR but we can't find the functiuns and pages to modify. Mar 3, 2021 at 9:21
  • I linked to the function you'd need to change above. To add the option value you'd need to add that here and then also add an upgrade script.
    – Demerit
    Mar 3, 2021 at 14:14
  • great! thanks Dave. Mar 3, 2021 at 15:09
  • do you know which template manages the contact summary where we also want to remove 'Nick Name'. We'll probably go for an extension instead of committing to CiviCRM's core. Mar 17, 2021 at 11:01
  • You shouldn't need edit the template if you use hook_civicrm_buildForm to alter the form based on your setting, but for reference it's github.com/civicrm/civicrm-core/blob/…
    – Demerit
    Mar 17, 2021 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.