How can I change the Contact Title?

Can I use a logic_hooks before opening a Contact page to build the Contact Title depending of the data? Or I need to change the core file (even if it’s not recommended)?

The title is build with: Salutation Firstname Lastname

image

But depending of a checkbox, I need to see an other field as the title.

No idea, any suggestions?

Hello , please refer this

We can override the labels in custom folder.

By the way, I found in ContactFormBase.php at line 175, I changed it; but no change in the UI

ln 175

If possible, I want to change in the custom folder; but if not possible, where is it in the real code?

Hi Harshad,

Thanks for your response, but do you know where/what is the field for the Contact dynamically create when we open a contact? This is field that I need to change or customize it.

Thanks.

I have tried at my end to display the contact title as first name followed by last name. Can you please try this

  1. Create a custom detail view file at custom/modules/Contacts/views/view.detail.php with the following code in it
<?php
require_once('modules/Contacts/views/view.detail.php');
class CustomContactsViewDetail extends ContactsViewDetail{
	protected function _getModuleTitleParams($browserTitle = false)
    {
		$last=$this->bean->last_name;
		$first=$this->bean->first_name;
		$salutation=$this->bean->salutation;
		$customTitle=$first." ".$last;
		return Array(1 => $customTitle);
	}
}
  1. Quick Repair & Rebuild from the admin and test by reloading the page.

image

1 Like

Hi Harshad,

Very thank you, it’s exactly what I need!! Where is it in the documentation? I never found that.

I need to adjust at 2 other places; do you know what function I need to change?

In the left menu
image

And in a the linked field

Thanks again!!

If you want to use simple formatting using the fields like first_name(f), last_name(l) , title(t), salutation(s) then you can specify in user interface by navigating

admin → system → locale

Yes, I know this easy formatting, but I can’t use it because I need to use custom fields to build the Contact’s name.

It’s why I need to know where I can modify it in the custom folder.

Hi slypower
At the top you wrote:

As that name format can be achieved in User profile settings that Harshad showed above - I guess you need something different?
Can you share examples of what you want the title to look like? I’m wondering if it is a middle-name you need to include, or perhaps a suffix to show the contact’s education status? Or something quite different?

Hi DJuser,

Harshad found the solution of my original issue. I’ll create another post for my others questions. (How to change the relate field values to use a custom field)

Thanks a lot!