Posted: February 7, 2018 at 7:47 pm
I’ve just updated the EE4 plugin on my website and the following message appeared in a floating box in front of the “50 rows written to csv…” messages.
[weird message start]
It only appeared once during the first time I tried to perform a Registration details export. Subsequently, it didn’t show up again. I checked the Plugins page and found that EE was not deactivated like the weird message said.
I’ve been going around testing the various functions we use most often and they seem to be working ok so far.
1) Is there any way to know what exactly happened that made those messages appear? WP_DEBUG was not true as this is our live website.
add_filter( ‘FHEE__EE_Export__report_registrations__reg_csv_array’, ‘espresso_add_course_id_csv’, 10, 2);
Does anyone know how to fix the issue of missing UTF8 bytes in the CSV export file?
If your server logs errors (it should) then you may find the error within that.
Usually, your host will have a section to view the error logs within your control panel, or if you have FTP access look for an error_log file within the root directory for your site.
We need the error to know if there is actually a problem but EE will attempt to fix any issues with the DB as it finds them anyway, if there is a problem that couldn’t be fixed you would see an error on each request made.
If your server is not logging error you can temporarily add this snippet:
To your wp-config.php file and re-run some tests on the system (try exporting the registrations again), any errors will be logged to /wp-content/debug.log and not shown directly on the site.
(Note don’t leave that enabled on your live server, just run some tests and see if you find any errors from EE in the log, then remove it again or set WP_Debug back to false)
Are you filtering the CSV using the
The first output sent to the CSV uses this:
Which should set the file to UTF-8, what are you adding to the beginning of the CSV to force it to work?
I’d recommend you set the column on each row regardless of whether or not you actually assign a value to it.
Have you confirmed that get_post_meta() is pulling in a value?
I’ve had a look at the error_log file and the last entry seems to be in Nov 2017 so I’m not sure if it is actively logging or not.
I’m not using that filter. Just the one in the code snippet I pasted.
I have not added anything to the CSV at all. The CSV export used to work just fine before I upgraded to 4.9.56.p. The old EE4 produced CSV files with the UTF8 marker intact. The only custom code in my site plugin to do with CSV is what I pasted in my original post.
I don’t understand this part of your reply. Can you explain it?
The upgraded EE4 gives me CSV files with the values I expect for each row in the custom column. So I assume get_post_meta() is doing its job.
It’s just the custom column header that’s missing. It used to export complete with “Course ID” as the header, but not now after upgrade.
Unfortunately, without the error, we don’t know what happened. You can check over the database to confirm all of the required tables/columns have been created, but, as mentioned EE will attempt to fix it anyway so its unlikely any will be missing otherwise you’d still be getting the errors above.
You mentioned above you’re manually adding the amending the CSV to make it work, I’m assuming you’re adding the same as the filter above?
In your code, you only set
In 4.8.25 EE pulled all of the registrations in a single request and then built the CSV, this is fine for smaller registrations but not larger groups, so we introduced a ‘batch’ method that pulls in smaller groups (default 50) of registrations into a temp file and build out the CSV as we go.
So let’s say the first batch of registrations don’t have a value for $my_course_id, you’ve just built out the temp file containing all of the details without a Course ID header. The next batch doesn’t know where to include the data. Whereas if you use the code example I gave you above, the column is always created for each registration row, but it’s empty if you don’t have a value.
Try this code:
Thanks for the tip regarding the new batch method and the code sample. I’ve modified my site specific code to add in the Course ID header successfully!
I mean I was modifying the downloaded CSV file and inserting the bytes manually. I just assumed that since the EE4.8.25.p generated CSV files opened up properly before, and I haven’t changed my site specific code, that the CSV files generated by EE4.9.56.p should still work fine.
I dug around the EE4 code a bit and found that EE4.9.56.p doesn’t seem to be using the EE_Export & EE_CSV classes to output the Registrations report any longer (at least this is true for exporting All Registrations). It seems to just use WP_Filesystem_Base classes via EEH_File to output the CSV directly without the UTF8 BOM.
Hmm, yeah you’re right.
We’ll need to do some investigating into this, but for the time being what you can do is switch EE back to the ‘old’ export system.
To do that you just need to add:
To your wp-config.php file, somewhere above the
The support post ‘Issues after upgrading from 4.8.25.p to 4.9.56.p’ 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.