Answers.Body: <p>The template you're looking for is templates/CRM/Member/Page/Tab.tpl.  The "browse" action is number 16, and takes up the vast majority of the template, starting around <a href="https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/Member/Page/Tab.tpl#L33" rel="nofollow noreferrer">line 33</a>.</p>
  
  <p>You'll want to populate the <code>$activeMembers</code> and/or <code>$inActiveMembers</code> array with modified data.  Those are defined in <a href="https://github.com/civicrm/civicrm-core/blob/master/CRM/Member/Page/Tab.php#L211" rel="nofollow noreferrer">CRM_Member_Page_Tab</a> around line 211, but most likely you'll want to modify the <code>$membership</code> array that they're both based on.  The <code>browse()</code> method of that function is mostly a "while" loop devoted to building the $membership array, but is sadly devoid of hooks.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-09T18:09:56.367Z
Answers.Text: Where do you think would be the best place to modify that array so that it won't interfere with updates? I know I can create a template override file. Is there a good way to modify it from the TPL? Thanks!
Answers.UserDisplayName: Sleewok
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-09T20:24:06.157Z
Answers.Text: You should be able to use `hook_civicrm_pageRun` to modify the array.  To modify the template, there's no great option, though both `hook_civicrm_alterTemplateFile` and `hook_civicrm_alterContent` offer a solution.  The community-oriented solution would be to rewrite this page to use the core search, which would let you use `hook_civicrm_searchColumns` after all.  Not sure how much work that would be though.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-07T23:37:15.110Z
Answers.LastActivityDate: 2017-01-07T23:37:15.110Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>You can do this using hook_civicrm_searchColumns</p>
  
  <p>More information about the hook in this page: <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_searchColumns" rel="nofollow">https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_searchColumns</a></p>
  
  <p>Hope this helps.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-09T21:04:52.100Z
Answers.Text: I am unable to get it to modify anything for the membership tab. I am able to get it working with the contribution and pledge tabs though.
Answers.UserDisplayName: Sleewok
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-10T21:17:12.520Z
Answers.Text: I have verified that it does NOT work for the membership tab. Please see the comment here: https://civicrm.org/blog/lobo/introducing-hookcivicrmsearchcolumns-modify-search-results-meet-your-needs
Answers.UserDisplayName: Sleewok
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-07T23:18:30.530Z
Answers.Text: `hook_civicrm_searchColumns` works on searches, not the tabs.  The contribution tab happens to use the search functionality to generate the data; memberships doesn't.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-08T15:55:36.083Z
Answers.LastActivityDate: 2016-08-08T15:55:36.083Z
Answers.UserDisplayName: Ghost
Body: <p>CiviCRM 4.7.9</p>
  
  <p>I have a custom field that I created for memberships. I would like to have this field displayed as a column within the membership tab when viewing a contact. </p>
  
  <p>I've been digging into the tpl/php files and trying to pin down how to do this, but I keep getting lost. </p>
  
  <p>Can anyone help give me some direction for this?</p>
  
  <p>Thanks!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-08T15:22:44.403Z
Comments.Text: Just as a suggestion, you might want to update your question with the version of Civi you're using... that might help people assist you a little more easily.  :-)
Comments.UserDisplayName: Lesley Carter - BackOffice
Tags: <civimember><contacts><custom-fields>
Title: Adding Custom Field to Contact Membership Tab
ThreadText: # Adding Custom Field to Contact Membership Tab
  
  (Asked by: username_0 on 2016-08-08)
  
  CiviCRM 4.7.9
  
  I have a custom field that I created for memberships. I would like to have this field displayed as a column within the membership tab when viewing a contact.
  
  I've been digging into the tpl/php files and trying to pin down how to do this, but I keep getting lost.
  
  Can anyone help give me some direction for this?
  
  Thanks!
  
  **Tags:** civimember, contacts, custom-fields
  
  > **Comments:**
  > **username_1**: Just as a suggestion, you might want to update your question with the version of Civi you're using... that might help people assist you a little more easily.  :-)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-01-07. Score: 2
  
  The template you're looking for is templates/CRM/Member/Page/Tab.tpl. The "browse" action is number 16, and takes up the vast majority of the template, starting around [line 33](https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/Member/Page/Tab.tpl#L33).
  
  You'll want to populate the `$activeMembers` and/or `$inActiveMembers` array with modified data. Those are defined in [CRM\_Member\_Page\_Tab](https://github.com/civicrm/civicrm-core/blob/master/CRM/Member/Page/Tab.php#L211) around line 211, but most likely you'll want to modify the `$membership` array that they're both based on. The `browse()` method of that function is mostly a "while" loop devoted to building the $membership array, but is sadly devoid of hooks.
  
  > **Comments:**
  > **username_0**: Where do you think would be the best place to modify that array so that it won't interfere with updates? I know I can create a template override file. Is there a good way to modify it from the TPL? Thanks!  
  > **username_2**: You should be able to use `hook_civicrm_pageRun` to modify the array.  To modify the template, there's no great option, though both `hook_civicrm_alterTemplateFile` and `hook_civicrm_alterContent` offer a solution.  The community-oriented solution would be to rewrite this page to use the core search, which would let you use `hook_civicrm_searchColumns` after all.  Not sure how much work that would be though.  
  
  ---
  
  ### Answer by username_3 on 2016-08-08. Score: 0
  
  You can do this using hook\_civicrm\_searchColumns
  
  More information about the hook in this page: <https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_searchColumns>
  
  Hope this helps.
  
  > **Comments:**
  > **username_0**: I am unable to get it to modify anything for the membership tab. I am able to get it working with the contribution and pledge tabs though.  
  > **username_0**: I have verified that it does NOT work for the membership tab. Please see the comment here: https://civicrm.org/blog/lobo/introducing-hookcivicrmsearchcolumns-modify-search-results-meet-your-needs  
  > **username_2**: `hook_civicrm_searchColumns` works on searches, not the tabs.  The contribution tab happens to use the search functionality to generate the data; memberships doesn't.  
  
  ---
  
  