CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Hook to display Custom Data with Core Data
Pages: [1]

Author Topic: Hook to display Custom Data with Core Data  (Read 2982 times)

natalievl

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Hook to display Custom Data with Core Data
January 05, 2010, 02:57:43 pm
Hi, I am in the process of customising the contact screen and want some of the Custom fields to be displayed with some other data, not in it's own box. I understand that I should create a new tpl and use the buildform hook to populate this data. Please prompt me as to what files i need to modify to do this in full. I have been testing, but it is not quite functional.
Thanks!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Hook to display Custom Data with Core Data
January 05, 2010, 04:41:30 pm
Hi,

Your explanation doesn't give enough information for me to be able to help. What is the URL you are trying to edit?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

natalievl

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: Hook to display Custom Data with Core Data
January 05, 2010, 07:06:03 pm
Hey, I can't send the url. It is not a public site.

On the edit contact screen, I need to display custom fields in the same section of the tpl as core fields. Ie. At the top near the first and last name and not in their own section.

Thanks in advance.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Hook to display Custom Data with Core Data
January 05, 2010, 10:26:42 pm
I don't need the sitename - just the path  - often giving the equivalent on the civicrm demo site is a good option
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

natalievl

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: Hook to display Custom Data with Core Data
January 06, 2010, 12:52:32 am
tpl folder:

/public_html/domain/sites/all/modules/civicrm/templates/CRM/common/*.tpl

And the folder for the php:

/public_html/domain/sites/all/modules/civicrm/CRM/edit.php 

Thanks!
 


Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Hook to display Custom Data with Core Data
January 06, 2010, 02:12:29 am
Nope, I still don't get what you're trying to do. Usually we create .tpl files to over-ride a specific template in CiviCRM so, for example, if we want to change the appearance of this page

http://sandbox.civicrm.org/civicrm/user?reset=1&id=102


we create a custom version of this tpl and put it in the over-ride directory (http://wiki.civicrm.org/confluence/display/CRMDOC/Directories) . CiviCRM will load it instead of the default one:

CRM/Contact/Page/View/UserDashBoard.tpl

If we want extra fields on our page that aren't there we can add them using the buildform hook but both custom tpls and buildform hooks are usually used to tweak existing CiviCRM pages. I'm not sure if you want to tweak a page or build a whole new one.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

natalievl

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: Hook to display Custom Data with Core Data
January 06, 2010, 02:39:36 am
Hi, I want to tweak the existing page...

I want some of the custom fields to appear underneath the first name and surname fields (without the line border surrounding the custom fields section)and other custom fields further down the page.

natalievl

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: Hook to display Custom Data with Core Data
January 06, 2010, 04:53:39 am
This is an example of kind of what i am trying to achieve...

http://civicrm.org/node/673

I do not know where to implment the code:
 // grab the set of custom fields and their type from the DB
   // ensure that you have the demographic custom group ID set
        $groupTree =& CRM_Core_BAO_CustomGroup::getTree( 'Contact',
                                                         $form,
                                                         $form->getVar( 'id' ),
                                                         CIVICRM_CANVASS_DEMOGRAPHICS_ID,
                                                         null, null );

        // we should use simplified formatted groupTree
        $groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree( $groupTree, 1, $form );

        // if there are fields to process
        if ( isset($groupTree) && is_array($groupTree) ) {
            $defaults = array( );
            CRM_Core_BAO_CustomGroup::setDefaults( $groupTree, $defaults);
            $form->setDefaults( $defaults );

            // lets build all the form elements with one nice function call
            CRM_Core_BAO_CustomGroup::buildQuickForm( $form, $groupTree, false, 1,
                                                      CIVICRM_CANVASS_DEMOGRAPHICS_PREFIX );
        }


natalievl

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: Hook to display Custom Data with Core Data
January 06, 2010, 05:48:31 am
A page discusses what i am trying to do, referring to the forums to find a solution. maybe the wording is better:

"Custom data groups show up in a separate tab or inline, so you will not be able to put your custom field near the lastname field without hacking the template (tpl) file. You can inquire on the forums for more information on how to hack CiviCRM. "

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Hook to display Custom Data with Core Data
January 06, 2010, 01:10:34 pm
Sounds like you are trying to hack the Summary screen for a Contact Record. Does the URL of a typical page that you are wanting to see the change look like this at the end - civicrm/contact/view?reset=1&cid=36244
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Hook to display Custom Data with Core Data

This forum was archived on 2017-11-26.