Posted: February 21, 2018 at 7:56 am
Hi, I would like to add the following variables to the csv report. You guys have a really great support forum in which I found a lot to customize event espresso to our needs. We would be glad if you you could help us with the following. – Add instructors from the people add-on
– can the quantity of event-dates and also duration in minutes (e.g. of the first date) be exported as a value in the csv report? – also the date and time of the first event? |
|
Hi there, The people add-on works differently to the venues, they are part of core. For people, you can use something like this: https://gist.github.com/Pebblo/e38dd403563b793c8cd2dde0189deed3 That adds a column called ‘People’ and loops over all people on the event adding “{person_name}({person_type})” to the CSV.
Hmm, I’m not sure I follow the first part. You want a count of the datetimes on the event? How do you have your events set up? Do you have a single ticket on multiple datetimes?
You mean datetime? It depends on your setup. Can you link to an event so I can see your ticket setup? |
|
Thank you Tony for the support. |
|
If you enable WP_DEBUG and retest the code, does it show an error? I’m using the above on a test site without a problem so will need the error to see what is happening. You enable WP_Debug within your
Set that to:
|
|
The code has actually been tested and verified to be working on a few test sites. You might have a missing bracket somewhere in your copy or maybe you copied in the opening PHP tag? |
|
The following message is shown: Fatal error: Uncaught Error: Call to undefined function write_log() in /pages/da/7f/d0013688/home/htdocs/motio_web/wordpress/testpage/wp-content/plugins/ee4-customization/ee4_customization_csv.php:34 Stack trace: #0 /pages/da/7f/d0013688/home/htdocs/motio_web/wordpress/testpage/wp-includes/class-wp-hook.php(286): tw_espresso_add_people_to_report(Array, Array) #1 /pages/da/7f/d0013688/home/htdocs/motio_web/wordpress/testpage/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array) #2 /pages/da/7f/d0013688/home/htdocs/motio_web/wordpress/testpage/wp-content/plugins/event-espresso-core-reg/core/libraries/batch/JobHandlers/RegistrationsReport.php(407): apply_filters(‘FHEE__EE_Export…’, Array, Array) #3 /pages/da/7f/d0013688/home/htdocs/motio_web/wordpress/testpage/wp-content/plugins/event-espresso-core-reg/core/libraries/batch/JobHandlers/RegistrationsReport.php(93): EventEspressoBatchRequest\JobHandlers\RegistrationsReport->get_csv_data_for(0, 0, 1, Array, Array) #4 /pages/da/7f/d0013688/home/htdocs/motio_web/word in /pages/da/7f/d0013688/home/htdocs/motio_web/wordpress/testpage/wp-content/plugins/ee4-customization/ee4_customization_csv.php on line 34 In line 34 the following is following value: After erasing this line the export with the “People” is working. Do I need the line? |
|
You don’t need that line. |
|
Thank you a lot. So we have now our instructors in the report. I am using custom fields to display the count of dates for the event, duration of one date of the event and other fields in the description and also be able to pull the information for the report. In the filtered report the name of the event is shown with the internal number in brackets. I would like to use the report without the number, only the event name. Is it possible to add the event name to the Event Registrant CSV Report or exclude the number from the Event (“Veranstaltung”) column in the filtered report? |
|
So you already have those saved on the event and want to pull the values for those custom fields into the CSV.
The CSV is filtered before each row is generated, they are all passed through this filter – So you can hook in and add any additional details you need. Note that we don’t not provide support for customizations, if we can help we’ll try to point you in the right direction and possible provide code examples such as the above but if you need more than that you’ll need the help of a developer.
Count how many datetimes are on the event you mean? And then automatically fill in your custom field with the qty of datetimes? It is likely possible but not something we have an example for so you’ll need some custom development.
Do you not need the Event ID in any of the reports? |
|
Hi Tony, thank you for the infos. We just started with event espresso and I am figuring out, what I can do on my own and where we need help in and in what scope. For example the count and duration was a question to understand how to optimize our system for the long run. I am tryin to adapt the workflow to the new system and the report is essential to that. It would be great if you could help me with this two things to complete my report settings. |
|
Please don’t edit core file to do any customization, we have filters to allow you to change the output so generally its unnecessary, if no filters are available we are more than happy to add them. So, yes you would need to add additional code to your customization plugin. You actually have a couple of options to remove that ID number, the code used to build the https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function The string you want to translate is
Or the other option is to use the above filter again,
At line 20 you have an EE Person object: https://gist.github.com/Pebblo/e38dd403563b793c8cd2dde0189deed3#file-example-php-L20 Take a look at the For example to pull the address you can do:
You then have an array containing all of that person address info to do whatever you prefer. Email you can grab using Then add them to |
|
Thank you Tony. Change wording is the easiest solution and works great. The additional information for the instructors are also working for me. Although the term “full_address_as_array()” brings the text “Array” into the export. But I added three function with address(), city(), zip(). I can work with that. I have also a custom field for the person “qualification” and understand that I have to add the get_post_meta but I don’t where. I understand which variable I have to edit but I cannot write my own code, so maybe there is also an example for the last part, that I could use. |
|
That’s because its an array and your adding the array directly. You can do something like Or use the individual methods you mentioned above. —
Remove When using our models if you call get_post_meta() on the object, it already passes the ID of the current object, so you just pass it the key and single.
|
|
That worked, thanks a lot. So my idea wasn’t that wrong. What/where do I have to add to have only the “staff” (People Types) in the report. That would the People Add-on more powerful to us. |
|
You can use something like:
You’ll obviously need to pass the event_id for the current event, and the type ID for the people type you want to pull. |
|
I’ve add the following line above the load_helper( ‘People_View’ ) and tried a couple things but there still multiple persons/types in the report. |
|
Yeah, it’s not as simple as adding the above line into the code and ‘Registration.EVT_ID’ doesn’t actually mean anything above.
Would return an array of people for the event from the type with ID 3. See: https://gist.github.com/Pebblo/e38dd403563b793c8cd2dde0189deed3#file-example2-php |
|
Yeah, I am trying to learn php but the more I get to it, the more complex it gets. I tried at first also with $reg_row[‘Registration.EVT_ID’] but that didn’t work either. With the code example2 I got an Fatal Error:
The line that brings the error is: |
|
My apologies, that’s a copy & paste error. I’ve fixed the code in my gist. |
|
Tony you’r the best. Thank you for your patience and the great support. |
|
You’re most welcome, I’m glad that worked for you 🙂 |
|
One more thing… https://gist.github.com/lorenzocaum/3bd7098e4ec311419fea8d02e85f36a8 I get as result “Array” and not the custom field. |
|
|
|
Do you have another idea? It still brings „Array“ as result. |
|
The code works for me, here’s a gist of what I tested: https://gist.github.com/joshfeck/95cfda40985010f0476d27fe0b279138 |
|
I‘ve tried it with an other custom field and it worked. The „qualifikation“ custom field is a checkbox field. Do you have an example how it would work with a checkbox field? |
|
WordPress itself does not support ‘checkbox’ custom fields, so that will have been added by a plugin. From your other threads I know that is likely to be ACF and yes it makes a difference as a checkbox field will return an array of values which needs to be handled differently that single text field (which would be the default type from WP).
Something like this should work: https://gist.github.com/Pebblo/4afdb79db1db59485047c142d5c22cf8 |
|
That’s really great. That will help me a lot in the workflow by processing the course after it has ended. |
|
Sure its possible, but you need the help of a developer. Your using ACF so you need to use the functions available within that: And: https://www.advancedcustomfields.com/resources/get_field/ We can’t provide support for custom development and working with other plugins, if you are not currently working with a developer we have some that are familiar with Event Espresso here: |
|
Hey Tony, I could only find how to get the value but not the key. I understand that this reaches over the scope of the support and will try not to post those question. |
|
One way to get the key: |
|
The support post ‘Add instructor, venue and custom fields to csv report’ 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.