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) »
  • Custom event field exposed in participant view? Or Event host in event view?
Pages: [1]

Author Topic: Custom event field exposed in participant view? Or Event host in event view?  (Read 1396 times)

dafeder

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: Drupal 6
  • MySQL version: 5.092
  • PHP version: 5.2
Custom event field exposed in participant view? Or Event host in event view?
March 12, 2011, 09:19:50 am
Hello, I have a custom numeric field in my events. I need to make a view that shows the event host, event time, and filters by this custom field. (These are classes, and this custom field is essentially a course ID).

In an event view, I can filter by my custom field just fine. In a participant view, I can filter by participant role and display the event time fields. However, the custom event fields are not visible in a participant view. On the other hand, the event host is not visible in an events view.

Is there any way I can do this?

Thanks!

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: Custom event field exposed in participant view? Or Event host in event view?
March 14, 2011, 04:25:03 am
Hi,

Try this patch, this will allow to use event related custom data on participant views :).
Don't forget to clear views cache, after applying this patch.

Code: [Select]
Index: drupal/modules/views/civicrm.views.inc
===================================================================
--- drupal/modules/views/civicrm.views.inc (revision 32865)
+++ drupal/modules/views/civicrm.views.inc (working copy)
@@ -5067,6 +5067,7 @@
         $tree = CRM_Core_BAO_CustomGroup::getTree( $entity_type, CRM_Core_DAO::$_nullObject, null, $groupID);
     }
 
+    $extajoins = array( );
     switch ($entity_type) {
             
     case "Contact":
@@ -5077,6 +5078,10 @@
         break;
     case "Event":
         $jointable = 'civicrm_event';
+        $extajoins['civicrm_participant'] = array(  'left_table'  => 'civicrm_event',
+                                                    'left_field'  => 'id',
+                                                    'right_field' => 'event_id',
+                                                    'field'       => 'entity_id' );
         break;
     case "Participant":
         $jointable = 'civicrm_participant';
@@ -5109,6 +5114,13 @@
                                       'field' => 'entity_id',
                                       ),
                   );
+
+        if ( !empty($extajoins) ) {
+            foreach( $extajoins as $jtable => $jfields ) {
+                $data[$currentgroup['table_name']]['table']['join'][$jtable] = $jfields;
+            }
+        }
+
         $currentgroupfields = $currentgroup['fields'];
         $customHTMLTypes = array( 'Select', 'Multi-Select', 'AdvMulti-Select', 'Radio', 'CheckBox',


Rajan

dafeder

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: Drupal 6
  • MySQL version: 5.092
  • PHP version: 5.2
Re: Custom event field exposed in participant view? Or Event host in event view?
March 14, 2011, 09:55:33 am
Sweet! Thank you, works perfectly.

Hope to see this in future releases.

dheffron

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
Re: Custom event field exposed in participant view? Or Event host in event view?
September 27, 2011, 09:43:36 am
In case someone else stumbles across this, you can accomplish the same thing by creating a relationship in your view for CiviCRM Participants: Participant's Contact ID. This will expose custom data for contacts to the view.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Custom event field exposed in participant view? Or Event host in event view?

This forum was archived on 2017-11-26.