Hi, I would like to customise the CSV report so that it can include the ticket URL
However, after my attempt, the CSV file only displayed data for:
1. Last Name
2. First Name
3. Email Address
But not for:
1. Phone Number
2. Ticket URL
Below is the code that I applied:
<?php
/*
Plugin Name: Site plugin for events.heydavid.io
Description: Site specific code for events.heydavid.io
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
/*
* This function allows you to set an array of ‘allowed’ fields that will be output to the registration CSV.
* The order in which they are set in the ‘allowed_fields_in_order’ array is the order that will be used by the CSV itself.
*/
function tw_ee_espresso_reg_report_filter_columns_ordered($csv_row, $registration_db_row)
{
// Set the allowed fields here and also set them in the order you want them to be displayed within the CSV
$allowed_fields_in_order = array(
__(‘Last Name’, ‘event_espresso’),
__(‘First Name’, ‘event_espresso’),
__(‘Email Address’, ‘event_espresso’),
__(‘Phone Number’, ‘event_espresso’),
__(‘Ticket URL’, ‘event_espresso’),
);
// Flip the array so the values are now the keys.
$allowed_fields_in_order = array_flip($allowed_fields_in_order);
// Set the value for each of the array elements to an empty string.
// This is incase any of the above questions do not exist in the current registration’s questions,
// they still need to be included in the row but the value should be nothing.
$allowed_fields_in_order = array_fill_keys(array_keys($allowed_fields_in_order), ”);
// Sets $filtered_csv_row to only contain the ‘allowed’ fields.
$filtered_csv_row = array_intersect_key(
$csv_row,
$allowed_fields_in_order
);
// Now lets set $filtered_csv_row to use the same custom order we set $allowed_fields_in_order to
$filtered_csv_row = array_merge($allowed_fields_in_order, $filtered_csv_row);
No, I don’t have an additional code for the Ticket URL. Can you either:
1. Share any existing Forum posts that have successfully performed this task. OR
2. What code should I add to the PHP file?
Hi Tony, I intend to use the Ticket URL in WhatsApp messaging so that the attendees can access the ticket details (with QR code) without digging into their inboxes.
<?php
/*
Plugin Name: Site plugin for events.heydavid.io
Description: Site specific code for events.heydavid.io
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
/*
* This function allows you to set an array of ‘allowed’ fields that will be output to the registration CSV.
* The order in which they are set in the ‘allowed_fields_in_order’ array is the order that will be used by the CSV itself.
*/
function tw_ee_espresso_reg_report_filter_columns_ordered($csv_row, $registration_db_row)
{
// Set the allowed fields here and also set them in the order you want them to be displayed within the CSV
$allowed_fields_in_order = array(
__(‘Last Name’, ‘event_espresso’),
__(‘First Name’, ‘event_espresso’),
__(‘Email Address’, ‘event_espresso’),
__(‘Phone’, ‘event_espresso’),
__(‘Ticket URL’, ‘event_espresso’),
);
// Flip the array so the values are now the keys.
$allowed_fields_in_order = array_flip($allowed_fields_in_order);
// Set the value for each of the array elements to an empty string.
// This is incase any of the above questions do not exist in the current registration’s questions,
// they still need to be included in the row but the value should be nothing.
$allowed_fields_in_order = array_fill_keys(array_keys($allowed_fields_in_order), ”);
// Sets $filtered_csv_row to only contain the ‘allowed’ fields.
$filtered_csv_row = array_intersect_key(
$csv_row,
$allowed_fields_in_order
);
// Now lets set $filtered_csv_row to use the same custom order we set $allowed_fields_in_order to
$filtered_csv_row = array_merge($allowed_fields_in_order, $filtered_csv_row);
August 26, 2024 – [proxy_fcgi:error [pid 26401:tid 140403839801088 [client 2001:f40:935:2ab9:8ddb:3aae:a4e3:5039:0 AH01071: Got error 'PHP message: PHP Parse error: syntax error, unexpected identifier "Name\xe2\x80\x99", expecting ")" in /home/1077368.cloudwaysapps.com/szgngnjyyq/public_html/wp-content/plugins/eventsheydavid/eventsheydavid-customizations.php on line 16', referer: https://events.heydavid.io/homepage/
If it is syntax error, it is commonly on comma, quotation or special characters. This error seems to be in Single quote ‘ because of some site, it is converted to weird styling and instead of just this quote ‘
Awesome. If you need anything, feel free to let us know.
thanks
Viewing 7 reply threads
The support post ‘Customise CSV Report to include ticket URL’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.