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) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • A view on participants and contact custom fields
Pages: [1]

Author Topic: A view on participants and contact custom fields  (Read 2033 times)

DanilaD

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 11
A view on participants and contact custom fields
June 27, 2009, 09:45:21 am
Looks like custom contact fields, exposed through a profile on event registration page, are later not available as fields in a view based on "CiviCRM Participants". I have already checked settings.php and cleared cache. 

Will look into the code.

Regards,
Danila

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: A view on participants and contact custom fields
June 28, 2009, 10:41:10 pm
Quote
Looks like custom contact fields, exposed through a profile on event registration page, are later not available as fields in a view based on "CiviCRM Participants".
yes, only participant custom fields are shown in Participant view.  You can see custom contact fields on contact "Summary" page.   
You Are Designed To Choose... Defined By Choice.

DanilaD

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 11
Re: A view on participants and contact custom fields
July 16, 2009, 09:26:06 am
Required code change is very small. One needs to edit file civicrm.views.inc, in the following area:

Code: [Select]
//Numeric Contact ID
    $data['civicrm_participant']['contact_id'] = array(
                                                       'title' => t('Participant\'s Contact ID'),
                                                       'help' => t('The numeric ID of the Contact of the Participant'),
                                                       'field' => array(
                                                                        'handler' => 'views_handler_field_numeric',
                                                                        'click sortable' => TRUE,
                                                                        ),

                                                       'argument' => array(
                                                                           'handler' => 'views_handler_argument_numeric',
                                                                           'numeric' => TRUE,
                                                                           ),

                                                       'filter' => array(
                                                                         'handler' => 'views_handler_filter_numeric',
                                                                         ),

                                                       'sort' => array(
                                                                       'handler' => 'views_handler_sort',
                                                                       ),
                                                       'relationship' => array(
                                                                  'base' => 'civicrm_contact',
                                                                  'field' => 'id',
                                                                  'handler' => 'views_handler_relationship',
                                                                  'label' => t('CiviCRM Contact, with custom fields'),
                                                                  ),
                                                       );

Added the lines
Code: [Select]
'relationship' => array(
                                                                  'base' => 'civicrm_contact',
                                                                  'field' => 'id',
                                                                  'handler' => 'views_handler_relationship',
                                                                  'label' => t('CiviCRM Contact, with custom fields'),
                                                                  ),
in the end. Then, while editing view, one need to create a relationship "Participant's Contact ID", and Contact Custom Fields will become available for selection as fields.

If someone will point me to the proper place to get current SVN branch, I'll submit a patch.

Regards,
Danila

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: A view on participants and contact custom fields
July 16, 2009, 09:45:57 am

http://svn.civicrm.org/civicrm/branches/v2.2/drupal/modules/views/
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

DanilaD

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 11
Re: A view on participants and contact custom fields
July 16, 2009, 09:59:46 am
Done: http://issues.civicrm.org/jira/browse/CRM-4751

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • A view on participants and contact custom fields

This forum was archived on 2017-11-26.