Advertisement
WillowDog

EE Code

Feb 22nd, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. <?php
  2. /**
  3. * Content Template for the [ESPRESSO_EVENT_ATTENDEES] shortcode
  4. *
  5. * @package Event Espresso
  6. * @subpackage templates
  7. * @since 4.6.29
  8. * @author Darren Ethier
  9. *
  10. * Template Args that are available in this template
  11. * @type EE_Attendee $contact
  12. * @type bool $show_gravatar whether to show gravatar or not.
  13. */
  14.  
  15.  
  16. $custom_question_output = '';
  17. if( $contact instanceof EE_Attendee ) {
  18. $prev_answer_value = EEM_Answer::instance()->get_var(
  19. array(
  20. array(
  21. 'Registration.ATT_ID' => $contact->ID(),
  22. 'Registration.EVT_ID' => $event->ID(),
  23. 'QST_ID' => 17 // replace with custom question's ID
  24. ),
  25. 'order_by' => array(
  26. 'ANS_ID' => 'DESC'
  27. ),
  28. 'limit' => 1
  29. ),
  30. 'ANS_value' );
  31. if( $prev_answer_value ) {
  32. $custom_question_output = '<br><span style="color:#585858; font-style:italic; font-size:.8em;">&nbsp; Player&apos;s Name: &nbsp;</span>' . $prev_answer_value;
  33. }
  34. }
  35.  
  36. $custom_question_output2 = '';
  37. if( $contact instanceof EE_Attendee ) {
  38. $prev_answer_value = EEM_Answer::instance()->get_var(
  39. array(
  40. array(
  41. 'Registration.ATT_ID' => $contact->ID(),
  42. 'Registration.EVT_ID' => $event->ID(),
  43. 'QST_ID' => 18 // replace with custom question's ID
  44. ),
  45. 'order_by' => array(
  46. 'ANS_ID' => 'DESC'
  47. ),
  48. 'limit' => 1
  49. ),
  50. 'ANS_value' );
  51. if( $prev_answer_value ) {
  52. $custom_question_output2 = ' ' . $prev_answer_value;
  53. }
  54. }
  55.  
  56.  
  57. if ( $show_gravatar ) {
  58. $gravatar = get_avatar( $contact->email(),
  59. (int) apply_filters( 'FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32 )
  60. );
  61. } else {
  62. $gravatar = '';
  63. }
  64.  
  65.  
  66.  
  67.  
  68. $states = EEM_State::instance()->get_all_states();
  69. $state = isset( $states[ $contact->state_ID() ] ) ? $states[ $contact->state_ID() ]->get( 'STA_name' ) : $contact->state_ID();
  70. $state = ! is_numeric( $state ) ? ', ' . $state : '';
  71. $countries = EEM_Country::instance()->get_all_countries();
  72. $country = isset( $countries[ $contact->country_ID() ] ) ? $countries[ $contact->country_ID() ]->get( 'CNT_name' ) : $contact->country_ID();
  73. $country = ! empty( $country ) ? ', ' . $country : '';
  74.  
  75. $group_size = $contact->get_most_recent_registration_for_event( $event->get('EVT_ID'))->get('REG_group_size');
  76. // if group size is 1, ditch the quantity display
  77. $group_size = $group_size > 1 ? '<br><span style="color:#C0C0C0; font-style:italic; font-size:.8em;">&nbsp; Total entries by Registrant (if >1): (' . $group_size . ')</span>' : '';
  78. ?>
  79.  
  80.  
  81.  
  82. <?php do_action( 'AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar ); ?>
  83. <li><?php echo $gravatar . '&nbsp;' . $contact->full_name() . ' '
  84. . ' &ndash; '
  85. . '<span style="color:#C0C0C0;">'
  86. . $contact->city()
  87. . $state
  88. . '</span>'
  89. . $group_size
  90. . '<span style="color:#707070; font-style:italic;">'
  91. . $custom_question_output
  92. . $custom_question_output2
  93. . '</span>'; ?></li>
  94.  
  95. <?php do_action( 'AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar ); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement