Posted: November 30, 2020 at 2:15 pm
|
For some reason, without making any changes, the registrations download broke today. Many lines have too many commas. Why could this be happening? There was a custom code added some time ago with your input, could this be broken? |
|
The download: |
|
It must be one of today’s registrations, because the download was working until yesterday. I can also run a registration download for last month and that works fine. |
|
I forgot to mention that there are the following custom functions that impact the CSV download (which has been working perfectly until yesterday’s registrations: |
Ok, so it may be something within the custom code and/or the registration itself so the first thing I would do is try to narrow down the registration(s) causing the CSV to break. Find your most recent registrations and find the events they are for, then view the registration list for each of those events and export. If ifs a specific registration that should help narrow it down a little as you’ll now know which event it was (assuming that all event registration reports work except one). Once you’ve narrowed down the registration you start digging into the registrant questions to see if anything stands out there. You could try removing the above code and commenting out the add_filter() lines to stop them hooking in, or de-activate the plugin they are within to see if the same broken export then works. If you find a specific event causing it I can take a look at the export and see if anything stands out there if preferred? |
|
|
Yes I found the registration, it’s this one: I also found the function that’s creating the problem: When I remove the function, it works: I think the reason is that we newly added new fields for the users to add their instagram accounts: If that assumption is correct, I’d need your help to modify the code to add these fields to the download file. Let me know what you think |
Ok, so the first test to do is to change when the above filter runs. Change this:
To this:
Retest, what happens? |
|
|
Didn’t work, I still get this download: |
That CSV still looks broken to me? Its better than before but Line 1 shows ‘PHOTOBASTEI 2.0’ in the Venue column and then the row below is a column out.
Possibly, its still an odd issue though. To add those columns to the CSV you can just add:
After this line: https://gist.github.com/altuno/71b100d90ebaf2b8da256ecdef5f421b#file-gistfile1-txt-L46 So it looks something like:
Then you’ll have the I’m not so sure that’s going to fix although it does seem to break on the ig-text-de column. — When you downloaded a CSV does it download when you click the button or does it redirect you to another page with a progress bar and then it downloads? |
|
|
Hello, It seems like we have the columns in order but the Transaction ID, Attendee ID and the Registration ID fields do not populate after the first line: https://www.loom.com/share/76fc2c3669e94ffd9592cce81250c5f3 I also tried filtering for October, same issue. Only the first line have these fields, then it stops populating them for the rest of the file. So not it’s not about a specific registration but something seems broken in how the report populates. |
Did you try what I suggested above? |
|
|
yes sure, that’s why you can now see the instagram handles in the download |
So I spent some time digging into this and I can’t reproduce, however, there have been some changes to EE since you added those snippets which may be affecting this so let’s get those updated and see what happens from there. The fact that you click the export and wee a ‘progress bar’ means you are using the batch export system (which you should be) and that has different filters available than the ‘old’ system. It checks for any of the old filters in use and applies them into the new system but by doing that EE is having to jump through various hooks so its best to switch to using the new filters (for the most part the only change needed is the filter name itself). Anywhere you have this: You can change it to: That’ll switch you over to the new filters (not so scary 😉 ). Next, each of the CSV rows should have the exact same rows and some of the snippets you are using check for values and/or if the row is for the primary registrant before adding the column. That means some rows may have the columns added and others not, which isn’t a great for the CSV as then commas don’t match (likely the issue here). Fixing that involves switching the code to always add the column and rather than try to explain that further, I’ve done it here: https://gist.github.com/Pebblo/d1ab608fac2c68450dab0f458b6baa45 Try that updated code in place of yours and see what happens then. |
|
|
Hi there, I used the code you sent me, still the same issue. It must be due to the code section where we set the array of “allowed fields” i guess, because when I remove it, the default fields seem to work. |
Ok, but why all of a sudden and I can’t reproduce so something else must be going on with it. We’ll need to see what is happening within that function for this and the easiest way to do that is using this little write_log function:
Add that to the top of your file and then uncomment these lines. Next, in your sites wp-config.php file, add this: https://eventespresso.com/wiki/troubleshooting-checklist/#wpdebug You should already have something like Then run an export (I recommend you filter down to the lowest number you can just to make the log easier) and export. Then check /wp-content/debug.log and search for ‘filtered_csv_row’ you’ll see 2 arrays, one is the registration row and the other is the CSV row. Add them to a\ gist so I can view them please. |
|
|
Here you go: |
Looks like this is due to translations and thats likely why I can’t reproduce. One more with a slight change to the code to confirm. Change the write_log call to be:
Then repeat the above export, please. |
|
|
Here you go: |
Yeah, its a translation issue. You said no changes were made on the site, so no plugins updates, nothing? What are you using for translations on the site? For your reports the initial request is not translating the CSV headers, see HERE But then on any additional requests, they are translated to Deutsch, see HERE. You also have some fields translating and others not. All of the combined is what is causing the problem here as the ‘allowed fields’ are valid for the first request, then they aren’t for any subsequent requests so the fields are missing. It isn’t a case of missing commas but array key fields that don’t match so the values aren’t being set. |
|
|
Hi Tony, When I said no changes, I meant nothing related to Event Espresso. Of course we update all plugins regularly, including WPML that we use for multi-language. I might have tried to add string translation for some fields a few years ago, then I realized it doesn’t work this way with Event Espresso, so finally ended up changing the name of fields to show both german and English. But this had never created an issue. Any suggestions how to fix this? We have the same installation on the French website, except we did not yet add the instagram field there, the downloads still work. |
|
PS: the wordpress base language of this site is German by the way. The EE4 installation is in English. Maybe that’s the issue? |
Any changes on your site can cause changes to any part of your site, so changes made outside of Event Espresso can still affect it.
Ok, so did you update plugins on the site on/around the 30th?
Where are you referring to here? The question text fields set on questions? If so that’s not the issue here.
I’m not sure how to fix this and there must be more to this than those fields. To explain a little, as mentioned the function I created basically takes an array of keys/values and then takes an array of ‘allowed’ fields and ‘merges’ them together taking the value from the original when it matches a field in the allowed array. So then if we look at how that would work, start here: https://gist.github.com/altuno/d22903dfb640c20a966c8295e747323c#file-debug-13-46-L247-L290 That’s the ‘original array’, it holds the key => value. Notice there that some of the ‘keys’ are translated. Then we have the allowed fields: https://gist.github.com/altuno/d22903dfb640c20a966c8295e747323c#file-debug-13-46-L247-L290 Those have no values, but again note they are all translated (that’s from my function). So then it pulls each element from the allowed list and compares with the original. “Does the original array have a key ‘Veranstaltung’, yes, use its value” (This is where things start to go wrong) “Does the original array have a key ‘Transaktions ID’, no? It’s on the allowed list to set the key but leave it empty as we don’t have a match” ‘Transaktions ID’ is translated in my function, but your csv_row is not, so your getting partial translations and that doesn’t make sense as you should get the same translations for both, so either the transactions load all or none, not some. —
EE should just use the language set within the sites general settings (Dashboard -> Settingd -> General -> Site language) |
|
|
Thank you Tony, I opened a ticket with WPML. As you say, when I disable WPML, the download works fine. They’re looking at this ticket right now. If you have any other points that can help them, feel free to add here. |
The support post ‘CSV download with too many commas’ 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.