Answers.Body: <p>You can create a block using view.</p>
  
  <p>Below exported view will list all events the logged in user is being registered.(To test you will need to import the views using below code)</p>
  
  <pre><code>$view = new view();
  $view-&gt;name = 'event_listing';
  $view-&gt;description = '';
  $view-&gt;tag = 'default';
  $view-&gt;base_table = 'civicrm_participant';
  $view-&gt;human_name = 'Event listing';
  $view-&gt;core = 7;
  $view-&gt;api_version = '3.0';
  $view-&gt;disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  
  /* Display: Master */
  $handler = $view-&gt;new_display('default', 'Master', 'default');
  $handler-&gt;display-&gt;display_options['title'] = 'Events';
  $handler-&gt;display-&gt;display_options['use_more_always'] = FALSE;
  $handler-&gt;display-&gt;display_options['access']['type'] = 'none';
  $handler-&gt;display-&gt;display_options['cache']['type'] = 'none';
  $handler-&gt;display-&gt;display_options['query']['type'] = 'views_query';
  $handler-&gt;display-&gt;display_options['exposed_form']['type'] = 'basic';
  $handler-&gt;display-&gt;display_options['pager']['type'] = 'full';
  $handler-&gt;display-&gt;display_options['pager']['options']['items_per_page'] = '10';
  $handler-&gt;display-&gt;display_options['style_plugin'] = 'default';
  $handler-&gt;display-&gt;display_options['row_plugin'] = 'fields';
  /* Field: CiviCRM Events: Title */
  $handler-&gt;display-&gt;display_options['fields']['title']['id'] = 'title';
  $handler-&gt;display-&gt;display_options['fields']['title']['table'] = 'civicrm_event';
  $handler-&gt;display-&gt;display_options['fields']['title']['field'] = 'title';
  $handler-&gt;display-&gt;display_options['fields']['title']['label'] = '';
  $handler-&gt;display-&gt;display_options['fields']['title']['element_label_colon'] = FALSE;
  $handler-&gt;display-&gt;display_options['fields']['title']['link_to_civicrm_event'] = 'page';
  /* Contextual filter: CiviCRM Participants: Participant's Contact ID */
  $handler-&gt;display-&gt;display_options['arguments']['contact_id']['id'] = 'contact_id';
  $handler-&gt;display-&gt;display_options['arguments']['contact_id']['table'] = 'civicrm_participant';
  $handler-&gt;display-&gt;display_options['arguments']['contact_id']['field'] = 'contact_id';
  $handler-&gt;display-&gt;display_options['arguments']['contact_id']['default_action'] = 'default';
  $handler-&gt;display-&gt;display_options['arguments']['contact_id']['default_argument_type'] = 'php';
  $handler-&gt;display-&gt;display_options['arguments']['contact_id']['default_argument_options']['code'] = 'civicrm_initialize();
  return CRM_Core_Session::singleton()-&gt;get(\'userID\');
  ';
  $handler-&gt;display-&gt;display_options['arguments']['contact_id']['summary']['number_of_records'] = '0';
  $handler-&gt;display-&gt;display_options['arguments']['contact_id']['summary']['format'] = 'default_summary';
  $handler-&gt;display-&gt;display_options['arguments']['contact_id']['summary_options']['items_per_page'] = '25';
  
  /* Display: Block */
  $handler = $view-&gt;new_display('block', 'Block', 'block');
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-16T12:54:07.793Z
Answers.Text: Thanks so much Pradeep! This is great for seeing all the events of a logged in user. If you get a chance (but no hurry and no problems if it's too much to ask) I'd be most grateful to learn how the php code in the contextual filter works, or if you could point me in the right direction. I'm not a php programmer, but able to understand essential concepts. Once again, thanks for your help.
Answers.UserDisplayName: Andyg8
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-17T03:23:01.537Z
Answers.Text: The code will return civicrm contact id of logged in user. All the events are registered with CiviCRM contact id and is tied with drupal user. So i used contextual filter to display all the events of a contact id who is logged in. Please close the question as answered if you feel i have answered your question correctly. Thank you so much! Cheerz
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-17T17:42:54.397Z
Answers.Text: Thanks Pradeep, very helpful. The question is not quite answered - while it's very helpful to know how to display all the events for a logged in user, I was actually hoping to show all the participants on an event, with a list of the other events they have registered for (past and present), within each participant's row. This enables us to get a quick overview of the participant's engagement with us before they come to the event.
Answers.UserDisplayName: Andyg8
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-17T17:43:23.667Z
Answers.Text: I did subsequently discover this is possible using a View of participants and including a 'Views Field View' of another view that shows the events per person. But that route seems very clunky and is prone to out-of-memory issues. I was thinking there must be an easier way!
Answers.UserDisplayName: Andyg8
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-12T10:27:58.667Z
Answers.LastActivityDate: 2018-01-12T10:27:58.667Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>This may have an embarassingly simple answer - apologies if I've missed it!</p>
  
  <p>When participants come to our events, we want to know what other events they have been on, or are booked on. </p>
  
  <p>I can make a Drupal View of participants and use table aggregator plus to group rows by person - enumerating that grouped row lists all the events a person has been on. But if I then filter the list by the event I'm interested in - of course we are only showing the single participation of each person on the event I filtered for. No more list of all events. </p>
  
  <p>I suppose we could make a group of the event participants and filter the view based on that, but it is all seeming a rather long way round to an issue that must already have come up. </p>
  
  <p>I'll be grateful for any ideas!</p>
  
  <p>Civicrm 4.7.27, Drupal 7.56</p>
  
Tags: <civievent><participants>
Title: For a particular event, how to list all the other events that participants have been on?
ThreadText: # For a particular event, how to list all the other events that participants have been on?
  
  (Asked by: username_0 on 2017-11-29)
  
  This may have an embarassingly simple answer - apologies if I've missed it!
  
  When participants come to our events, we want to know what other events they have been on, or are booked on.
  
  I can make a Drupal View of participants and use table aggregator plus to group rows by person - enumerating that grouped row lists all the events a person has been on. But if I then filter the list by the event I'm interested in - of course we are only showing the single participation of each person on the event I filtered for. No more list of all events.
  
  I suppose we could make a group of the event participants and filter the view based on that, but it is all seeming a rather long way round to an issue that must already have come up.
  
  I'll be grateful for any ideas!
  
  Civicrm 4.7.27, Drupal 7.56
  
  **Tags:** civievent, participants
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-12. Score: 1
  
  You can create a block using view.
  
  Below exported view will list all events the logged in user is being registered.(To test you will need to import the views using below code)
  
  ```
  $view = new view();
  $view->name = 'event_listing';
  $view->description = '';
  $view->tag = 'default';
  $view->base_table = 'civicrm_participant';
  $view->human_name = 'Event listing';
  $view->core = 7;
  $view->api_version = '3.0';
  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  
  /* Display: Master */
  $handler = $view->new_display('default', 'Master', 'default');
  $handler->display->display_options['title'] = 'Events';
  $handler->display->display_options['use_more_always'] = FALSE;
  $handler->display->display_options['access']['type'] = 'none';
  $handler->display->display_options['cache']['type'] = 'none';
  $handler->display->display_options['query']['type'] = 'views_query';
  $handler->display->display_options['exposed_form']['type'] = 'basic';
  $handler->display->display_options['pager']['type'] = 'full';
  $handler->display->display_options['pager']['options']['items_per_page'] = '10';
  $handler->display->display_options['style_plugin'] = 'default';
  $handler->display->display_options['row_plugin'] = 'fields';
  /* Field: CiviCRM Events: Title */
  $handler->display->display_options['fields']['title']['id'] = 'title';
  $handler->display->display_options['fields']['title']['table'] = 'civicrm_event';
  $handler->display->display_options['fields']['title']['field'] = 'title';
  $handler->display->display_options['fields']['title']['label'] = '';
  $handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
  $handler->display->display_options['fields']['title']['link_to_civicrm_event'] = 'page';
  /* Contextual filter: CiviCRM Participants: Participant's Contact ID */
  $handler->display->display_options['arguments']['contact_id']['id'] = 'contact_id';
  $handler->display->display_options['arguments']['contact_id']['table'] = 'civicrm_participant';
  $handler->display->display_options['arguments']['contact_id']['field'] = 'contact_id';
  $handler->display->display_options['arguments']['contact_id']['default_action'] = 'default';
  $handler->display->display_options['arguments']['contact_id']['default_argument_type'] = 'php';
  $handler->display->display_options['arguments']['contact_id']['default_argument_options']['code'] = 'civicrm_initialize();
  return CRM_Core_Session::singleton()->get(\'userID\');
  ';
  $handler->display->display_options['arguments']['contact_id']['summary']['number_of_records'] = '0';
  $handler->display->display_options['arguments']['contact_id']['summary']['format'] = 'default_summary';
  $handler->display->display_options['arguments']['contact_id']['summary_options']['items_per_page'] = '25';
  
  /* Display: Block */
  $handler = $view->new_display('block', 'Block', 'block');
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks so much username_1! This is great for seeing all the events of a logged in user. If you get a chance (but no hurry and no problems if it's too much to ask) I'd be most grateful to learn how the php code in the contextual filter works, or if you could point me in the right direction. I'm not a php programmer, but able to understand essential concepts. Once again, thanks for your help.  
  > **username_1**: The code will return civicrm contact id of logged in user. All the events are registered with CiviCRM contact id and is tied with drupal user. So i used contextual filter to display all the events of a contact id who is logged in. Please close the question as answered if you feel i have answered your question correctly. Thank you so much! Cheerz  
  > **username_0**: Thanks username_1, very helpful. The question is not quite answered - while it's very helpful to know how to display all the events for a logged in user, I was actually hoping to show all the participants on an event, with a list of the other events they have registered for (past and present), within each participant's row. This enables us to get a quick overview of the participant's engagement with us before they come to the event.  
  > **username_0**: I did subsequently discover this is possible using a View of participants and including a 'Views Field View' of another view that shows the events per person. But that route seems very clunky and is prone to out-of-memory issues. I was thinking there must be an easier way!  
  
  ---
  
  