That worked very sweet.. I created some extra custom code also because i needed to count the totals of the custom1 field and the total members + the custom field. And it worked out nice
Here’s the code for someone that would need some help:
<?php
/*
=== Load parent Styles ===
*/
function dc_enqueue_styles() {
wp_enqueue_style( ‘divi-parent’, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array( ‘divi-parent’ ) );
}
add_action( ‘wp_enqueue_scripts’, ‘dc_enqueue_styles’ );
function ru_custom_attendee_list( $registrants_data ) {
$totals = 0;
$html = ‘<div class=”tribe-events-event-meta rtec-event-meta rtec-attendee-list-meta”>’;
$html .= ‘<h3 class=”rtec-section-title”>Aangemeld</h3>’;
$html .= ‘<div style=”padding: 0 4%”>’;
$html .= ‘<table width=””>’;
$html .= ‘<thead>’;
$html .= ‘<tr>’;
$html .= ‘<th>Naam</th>’;
$html .= ‘<th>Achternaam</th>’;
$html .= ‘<th>Introducees</th>’;
$html .= ‘</tr>’;
$html .= ‘</thead>’;
$html .= ‘<tbody>’;
// loops through the $registrants_data and displays the values in their array order
foreach ( $registrants_data as $registration ) {
$html .= ‘<tr>’;
$totals += $registration[“custom1”];
$totals2 += $registration[“custom1″];
foreach ( $registration as $key => $value ) {
$html .= ‘<td valign=”top”>’ . esc_html( $value ) . ‘</td>’;
}
$totals2 += 1;
$html .= ‘</tr>’;
}
$html .= ‘<tr><td colspan=2>Totaal introducees</td><td>’. $totals .'</td></tr>’;
$html .= ‘<tr><td colspan=2>Totaal deelnemers</td><td>’. $totals2 .'</td></tr>’;
$html .= ‘</tbody>’;
$html .= ‘</table>’;
$html .= ‘</div>’;
$html .= ‘</div>’;
echo $html;
}
// removes the default attendee list, otherwise you will have two lists
remove_action( ‘rtec_the_attendee_list’, ‘rtec_the_default_attendee_list’ );
add_action( ‘rtec_the_attendee_list’, ‘ru_custom_attendee_list’ );
function ru_attendee_list_settings_filter( $attendee_list_fields ) {
// adds custom field data to the $registrants_data for the custom attendee list
$attendee_list_fields = array( ‘first_name’, ‘last_name’, ‘custom1’ );
return $attendee_list_fields;
}
add_filter( ‘rtec_attendee_list_fields’, ‘ru_attendee_list_settings_filter’, 10, 1 );