Answers.Body: <p>So I came up with two solutions of my own.</p>
  <p><strong>SOLUTION #1:</strong> The simplier one, I implemented from a WordPress plugin using <code>hook_civicrm_contact_get_displayname</code> but you could also impement it from within a civicrm plugin as well. This is fairly simple code and will add the nickname (if it exists) to the end of the display name, everywhere the display name is shown. Here is wordpress plugin code:</p>
  <pre><code>require_once(ABSPATH . 'wp-includes/pluggable.php');
  add_filter( 'civicrm_contact_get_displayname', 'my_customhook_civicrm_contact_get_displayname', 10, 4  );
  function my_customhook_civicrm_contact_get_displayname(&amp;$display_name, $contactId, $dao) {
      $nick_name = trim($dao-&gt;nick_name);
      if ($nick_name != &quot;&quot; &amp;&amp; ! is_null($nick_name) ) {
          $display_name .= &quot; [$nick_name]&quot;;
      }
  }
  </code></pre>
  <p>Here is what solution #1 looks like:</p>
  <p><a href="https://i.sstatic.net/JfqLQZY2.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JfqLQZY2.jpg" alt="solution 1" /></a></p>
  <p><strong>SOLUTION #2:</strong> Is the more complicated one, using the buildForm hook from within a civicrm plugin. It will only display the nickname at the end of the display name within the View Contact Summary pages (at the top of the page). It has the advantage of being able to style the nickname portion different from the rest of the display name so you can make it stand out or be less obtrusive. Here is civicrm plugin code:</p>
  <pre><code>function my_customfunctions_civicrm_buildForm($formName, &amp;$form) {
    if ($formName == &quot;CRM_Activity_Form_ActivityLinks&quot;) {
      if (strpos($_SERVER['QUERY_STRING'], &quot;page=CiviCRM&quot;) !== false &amp;&amp; strpos($_SERVER['QUERY_STRING'], &quot;q=civicrm%2Fcontact%2Fview&quot;) !== false) { // This checks to make sure its the Contact View page only that I am modifying.
        
        // Add javascript to the page.
        // Need to use   +String.fromCharCode(39)+   to wrap span id in single-quotes.
        // Need to check if the Nickname was already added, otherwise it gets added more than once.
        CRM_Core_Region::instance('page-body')-&gt;add( ['script' =&gt; &quot;nicknode = document.getElementsByClassName('crm-summary-display_name')[0]; nicknode_text = nicknode.textContent; nickname = document.getElementsByClassName('crm-content crm-contact-nick_name')[0]; nickname_text = nickname.textContent; if (nicknode_text.length &gt; 0 &amp;&amp; nickname_text.length &gt; 0) { if (nicknode_text.includes(nickname_text) == false) { nicknode.innerHTML = nicknode_text + ' &lt;span id='+String.fromCharCode(39)+'civicrm-customjs-nickname'+String.fromCharCode(39)+' &gt;[' + nickname_text + ']&lt;/span&gt;'; } }&quot; ] );
  
        // Add some CSS for the newly added span tag to style as-needed.
        CRM_Core_Region::instance('page-body')-&gt;add( ['script' =&gt; &quot;cj('#civicrm-customjs-nickname').css('font-size', '75%'); cj('#civicrm-customjs-nickname').css('font-style', 'italic');&quot;] );
        
      }
    }
  }
  </code></pre>
  <p>Here is what solution #2 looks like (you can style the nickname portion):</p>
  <p><a href="https://i.sstatic.net/TMwVtd0J.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TMwVtd0J.jpg" alt="solution 2" /></a></p>
  <p>Of course I came up with the 2nd more complicated solution first, before finding the simpler solution #1.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-06T22:55:51.240Z
Answers.LastActivityDate: 2024-08-06T23:05:21.633Z
Answers.LastEditDate: 2024-08-06T23:05:21.633Z
Answers.UserDisplayName: jsherk
Answers.Body: <p>Without doing any coding you could create a new block using the Contact Layout Editor, and put the Nickname into it.  This block could then be put top left of the summary area - this is something I've done already.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-06T21:19:36.823Z
Answers.Text: Excellent idea... I like it as an alternative to @coleman answer because it would only be on the contact summary screen.
Answers.UserDisplayName: jsherk
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-06T17:38:21.813Z
Answers.LastActivityDate: 2024-08-06T17:38:21.813Z
Answers.UserDisplayName: Andy Clark
Answers.Body: <p>Yes, you can do this without any code by updating which fields constitute a &quot;display name&quot;. By default Civi uses 4 fields: prefix, first, last &amp; suffix. You can configure this by navigating to &quot;Administer -&gt; Customize Data &amp; Screens -&gt; Display Preferences&quot; and scroll down to &quot;Individual Display Name Format&quot;.</p>
  <p><a href="https://i.sstatic.net/U48hKvED.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/U48hKvED.png" alt="Individual Display Name Format" /></a></p>
  <p>Note that this will affect contact display names everywhere, system-wide, not just on the contact summary screen.</p>
  <p>Also note that this change is passive, which means the existing contacts in the database will not have their display names automatically updated when you modify this template. You'll have to edit &amp; re-save every contact with a nickname for it to take effect.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-06T21:19:55.753Z
Answers.Text: Ahh... could it be any simplier?
Answers.UserDisplayName: jsherk
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-06T21:28:51.370Z
Answers.Text: Hmm... does not seem to work. Even after running clean caches, still nothing extra displays. `{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}{ }{contact.nick_name}`. I even tried just putting some test text in, but that does not show up either.
Answers.UserDisplayName: jsherk
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-06T22:25:31.983Z
Answers.Text: The update is passive, e.g. you have to update & save the contact for changes to take effect. Try it out on a single contact. Once you're happy with your template there are a few ways to update every contact in the database, one would be with the api explorer, you could do Individual - Update - Where nick_name IS NOT EMPTY
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-06T23:13:59.983Z
Answers.Text: Oh I see, this actually updates and saves the nick_name as part of the display_name in db, so it will display that way going forward (but requires a save first).
Answers.UserDisplayName: jsherk
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-06T19:02:38.610Z
Answers.LastActivityDate: 2024-08-07T18:03:33.683Z
Answers.LastEditDate: 2024-08-07T18:03:33.683Z
Answers.UserDisplayName: Coleman
Answers.Body: <p>You can implement pagerun hook to over-ride the title</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-06T21:18:41.723Z
Answers.Text: I looked at pagerun hook, but I think it is the buildform hook that would need to be used.
Answers.UserDisplayName: jsherk
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-05T21:33:26.570Z
Answers.LastActivityDate: 2024-08-05T21:33:26.570Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>Is it possible to somehow get the Nickname to display up at the top of the contacts page?</p>
  <p>Is there an preference for this somewhere, or an extension that can do this?</p>
  <p>I am on CiviCRM v5.75.0 on WordPress v6.6.1</p>
  <p>I am using the Contact Layout Editor by Coleman Watts, which lets me re-organize the contact page layout of different sections, but does not let me move individual fields from one section to another section.</p>
  <p>See screenshot of what I am trying to do:<a href="https://i.sstatic.net/QsitWVkn.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QsitWVkn.jpg" alt="nickname" /></a></p>
  
Tags: <wordpress><contacts><contact-view><contact-layout-editor>
Title: Display Nickname at the top of Contact Details page?
ThreadText: # Display Nickname at the top of Contact Details page?
  
  (Asked by: username_0 on 2024-08-05)
  
  Is it possible to somehow get the Nickname to display up at the top of the contacts page?
  
  Is there an preference for this somewhere, or an extension that can do this?
  
  I am on CiviCRM v5.75.0 on WordPress v6.6.1
  
  I am using the Contact Layout Editor by username_2 Watts, which lets me re-organize the contact page layout of different sections, but does not let me move individual fields from one section to another section.
  
  See screenshot of what I am trying to do:[![nickname](https://i.sstatic.net/QsitWVkn.jpg)](https://i.sstatic.net/QsitWVkn.jpg)
  
  **Tags:** wordpress, contacts, contact-view, contact-layout-editor
  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_0 on 2024-08-06. Score: 1 | Accepted answer
  
  So I came up with two solutions of my own.
  SOLUTION #1: The simplier one, I implemented from a WordPress plugin using hook_civicrm_contact_get_displayname but you could also impement it from within a civicrm plugin as well. This is fairly simple code and will add the nickname (if it exists) to the end of the display name, everywhere the display name is shown. Here is wordpress plugin code:
  require_once(ABSPATH . 'wp-includes/pluggable.php');
  add_filter( 'civicrm_contact_get_displayname', 'my_customhook_civicrm_contact_get_displayname', 10, 4  );
  function my_customhook_civicrm_contact_get_displayname(&$display_name, $contactId, $dao) {
      $nick_name = trim($dao->nick_name);
      if ($nick_name != "" && ! is_null($nick_name) ) {
          $display_name .= " [$nick_name]";
      }
  }
  
  Here is what solution #1 looks like:
  
  SOLUTION #2: Is the more complicated one, using the buildForm hook from within a civicrm plugin. It will only display the nickname at the end of the display name within the View Contact Summary pages (at the top of the page). It has the advantage of being able to style the nickname portion different from the rest of the display name so you can make it stand out or be less obtrusive. Here is civicrm plugin code:
  function my_customfunctions_civicrm_buildForm($formName, &$form) {
    if ($formName == "CRM_Activity_Form_ActivityLinks") {
      if (strpos($_SERVER['QUERY_STRING'], "page=CiviCRM") !== false && strpos($_SERVER['QUERY_STRING'], "q=civicrm%2Fcontact%2Fview") !== false) { // This checks to make sure its the Contact View page only that I am modifying.
        
        // Add javascript to the page.
        // Need to use   +String.fromCharCode(39)+   to wrap span id in single-quotes.
        // Need to check if the Nickname was already added, otherwise it gets added more than once.
        CRM_Core_Region::instance('page-body')->add( ['script' => "nicknode = document.getElementsByClassName('crm-summary-display_name')[0]; nicknode_text = nicknode.textContent; nickname = document.getElementsByClassName('crm-content crm-contact-nick_name')[0]; nickname_text = nickname.textContent; if (nicknode_text.length > 0 && nickname_text.length > 0) { if (nicknode_text.includes(nickname_text) == false) { nicknode.innerHTML = nicknode_text + ' [' + nickname_text + ']'; } }" ] );
  
        // Add some CSS for the newly added span tag to style as-needed.
        CRM_Core_Region::instance('page-body')->add( ['script' => "cj('#civicrm-customjs-nickname').css('font-size', '75%'); cj('#civicrm-customjs-nickname').css('font-style', 'italic');"] );
        
      }
    }
  }
  
  Here is what solution #2 looks like (you can style the nickname portion):
  
  Of course I came up with the 2nd more complicated solution first, before finding the simpler solution #1.
  
  
  ---
  
  ### Answer by username_1 on 2024-08-06. Score: 3
  
  Without doing any coding you could create a new block using the Contact Layout Editor, and put the Nickname into it. This block could then be put top left of the summary area - this is something I've done already.
  
  > **Comments:**
  > **username_0**: Excellent idea... I like it as an alternative to @coleman answer because it would only be on the contact summary screen.  
  
  ---
  
  ### Answer by username_2 on 2024-08-06. Score: 2
  
  Yes, you can do this without any code by updating which fields constitute a "display name". By default Civi uses 4 fields: prefix, first, last & suffix. You can configure this by navigating to "Administer -> Customize Data & Screens -> Display Preferences" and scroll down to "Individual Display Name Format".
  
  [![Individual Display Name Format](https://i.sstatic.net/U48hKvED.png)](https://i.sstatic.net/U48hKvED.png)
  
  Note that this will affect contact display names everywhere, system-wide, not just on the contact summary screen.
  
  Also note that this change is passive, which means the existing contacts in the database will not have their display names automatically updated when you modify this template. You'll have to edit & re-save every contact with a nickname for it to take effect.
  
  > **Comments:**
  > **username_0**: Ahh... could it be any simplier?  
  > **username_0**: Hmm... does not seem to work. Even after running clean caches, still nothing extra displays. `{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}{ }{contact.nick_name}`. I even tried just putting some test text in, but that does not show up either.  
  > **username_2**: The update is passive, e.g. you have to update & save the contact for changes to take effect. Try it out on a single contact. Once you're happy with your template there are a few ways to update every contact in the database, one would be with the api explorer, you could do Individual - Update - Where nick_name IS NOT EMPTY  
  > **username_0**: Oh I see, this actually updates and saves the nick_name as part of the display_name in db, so it will display that way going forward (but requires a save first).  
  
  ---
  
  ### Answer by username_3 on 2024-08-05. Score: 0
  
  You can implement pagerun hook to over-ride the title
  
  > **Comments:**
  > **username_0**: I looked at pagerun hook, but I think it is the buildform hook that would need to be used.  
  
  ---
  
  