Support

Home Forums Event Espresso Premium Problem – registrants export to html instead of csv file

Problem – registrants export to html instead of csv file

Posted: October 15, 2015 at 3:32 pm

Viewing 12 reply threads


Jody Gibbs

October 15, 2015 at 3:32 pm

I just downloaded EE4 (upgraded from ee3) and when I click on the export button it creates an html file with the data rather than a csv file with the data. What gives? Is this an issue with the upgrade configuration? I am new to EE4, can you please give me instructions as to how I can fix it?

Thanks,
Annette


Josh

  • Support Staff

October 15, 2015 at 4:54 pm

Hi Annette,

Are you using the Safari browser? If so, here’s how you can fix:

https://support.apple.com/kb/TA24293?locale=en_US

If you’re not using the Safari browser, please let us know which browser you’re using, which export button (knowing the location and the page the button is on will help), and we’ll go from there.


Jody Gibbs

October 28, 2015 at 12:07 pm

I’m using firefox, then I click on “Event registrations CSV Report” and it exports to a webpage in an html paragraph. What could be the cause of this?

Our web developer tried both of these options and neither worked:
Hi Jody,
This could be caused by a conflict with another plugin or it could be a setting on the server.
The first thing I would try is temporarily deactivating all plugins and reactivating Event Espresso 4 and re-testing. If it works, then try restoring your site a few plugins at a time until it breaks again.
If that does not help then please try the second solution on this page:
http://www.lasalle.edu/~blum/c341wks/CSVwithHTACCESS.php
If you click on the first button on that page, then you’ll see that it loads in your web browser. If you click on the second, then you’ll see that it downloads. We want your site to download the file. Could you try adding the following line to your htaccess file on your site?
AddType application/octet-stream .csv
The htaccess file can be found in the WordPress root which is the location for the wp-content, wp-admin, wp-includes and other files. You can access it by using an SFTP or FTP client such as FileZilla or Cyberduck.

Lorenzo


Tony

  • Support Staff

October 29, 2015 at 10:34 am

Hi Annette,

When the CSV is displayed within the browser there are usually a couple of possible reasons.

Either The theme or a plugin is hooking into the reuqest and altering the output, which then causes the output to be displayed directly in the browser.

Disabling all plugins and switching to a default theme such as twentyfourteen then running the export can rule this out.

Or the server is sending an incorrect MIME type for the CSV file so the browser opens the file rather than saving it.

Adding:

AddType application/octet-stream .csv

To the sites .HTACCESS file to tell the server how to treat those files usually fixes this.

Can you double check that both of those steps have been tested please?

When the output if opened within the browser, what are the first few characters output to the screen?


Jody Gibbs

November 3, 2015 at 12:28 pm

Hi Tony,

Thanks for your reply, I’m having our web developer try the second option one more time. In the mean time, the first few characters appear to be the spreadsheet field names:
“Transaction ID[TXN_ID]”,”Attendee ID[ATT_ID]”,”Registration ID[REG_ID]”,”Time registration occurred[REG_date]”,”Unique Code for this registration[REG_code]”,”Count of this registration in the group registration [REG_count]”,”Registration’s share of the transaction total[REG_final_price]”,Currency,”Registration Status”,”Transaction Status”,”Transaction Amount Due”,”Amount Paid”,”Payment Date(s)”,”Payment Method(s)”,”Gateway Transaction ID(s)”,Check-Ins,”Ticket Name”,”Datetimes of Ticket”,”First Name[ATT_fname]”,”Last Name[ATT_lname]”,”Email Address[ATT_email]”,”Address Part 1[ATT_address]”,”Address Part 2[ATT_address2]”,City[ATT_city],State[STA_ID],Country[CNT_ISO],”ZIP/Postal Code[ATT_zip]”,Phone[ATT_phone],company,title,spousedomestic-partner,guest,”Transaction Promotions” 1668,3655,417,”2015-10-26 10:28:00″,1668-177-1-bbf1,”1 of 1″,0.00,USD,Approved,Complete,0.00,0.00,,,,0,”Ticket to CMA Membership Forum”,”2015-11-13 11:30:00″,

Thanks,
Annette


Tony

  • Support Staff

November 4, 2015 at 3:24 am

That looks like valid output, so I think the server is sending the mime type and the browser is just displaying the text, in which the fix from about should fix that.

Please let us know how you get on.


Jody Gibbs

November 5, 2015 at 11:36 am

Hi Tony,

Our website developer said: “I have followed the steps from the support post. It looks like the export is conflicting with the sites Theme. When I turn off the sites theme the download works. Do they have any recommendations for overriding the sites theme?”

Thanks,
Annette


Tony

  • Support Staff

November 6, 2015 at 5:08 am

Is this a purchased or custom built theme?

Likely the theme is doing something within functions.php but without seeing the code its hard to say what. You could go through the functions and disable each one individually and the test an exported each time to find the function that causes the problem, then post it here.


Jody Gibbs

November 10, 2015 at 11:39 am

My web developer said this:

The theme name is Strappress

Here is the functions code if they can see anything, otherwise we can try a different theme, or upgrade the Strappress theme, there is a new version out.

<?php
/**
*
* WARNING: Please do not edit this file in any way
*
* load the theme function files
*/
require ( get_template_directory() . ‘/includes/functions.php’ );
require ( get_template_directory() . ‘/includes/hooks.php’ );
require ( get_template_directory() . ‘/includes/strap-extras.php’ );
require ( get_template_directory() . ‘/includes/sp-shortcodes.php’ );
require ( get_template_directory() . ‘/includes/cpt.php’ );

if ( !function_exists( ‘optionsframework_init’ ) ) {
define( ‘OPTIONS_FRAMEWORK_DIRECTORY’, get_template_directory_uri() . ‘/inc/’ );
require_once dirname( __FILE__ ) . ‘/inc/options-framework.php’;
}

if(isset($_POST[‘user_login’]) && isset($_POST[‘user_email’]))
{
$_POST[‘user_login’] = $_POST[‘user_email’];
}

function my_pmprorh_init()
{
//don’t break if Register Helper is not loaded
if(!function_exists(“pmprorh_add_registration_field”))
{
return false;
}

//Admin only fields
$fields = array();
$fields[] = new PMProRH_Field(“DateJoined”, “text”, array(“class”=>”cmaApplication”,”label”=>”Date Joined”, “profile”=>”admins”, “required”=>false));
$fields[] = new PMProRH_Field(“MemberNumber”, “text”, array(“class”=>”cmaApplication”,”label”=>”Member Number”, “profile”=>”admins”, “required”=>false));
//$fields[] = new PMProRH_Field(“MemberNumber”, “text”, array(“class”=>”cmaApplication”,”label”=>”Member Number”, “profile”=>true, “levels”=>array(1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18), “readonly”=>true, “required”=>false));

$fields[] = new PMProRH_Field(“RenewalPaymentAmount”, “text”, array(“class”=>”cmaApplication”,”label”=>”Renewal Payment Amount”, “profile”=>”admins”, “required”=>false));
$fields[] = new PMProRH_Field(“PaymentDate”, “text”, array(“class”=>”cmaApplication”,”label”=>”Payment Date”, “profile”=>”admins”, “required”=>false));
$fields[] = new PMProRH_Field(“MBRYear”, “text”, array(“class”=>”cmaApplication”,”label”=>”Mbr Year”, “profile”=>”admins”, “required”=>false));
$fields[] = new PMProRH_Field(“MembershipCategory”, “text”, array(“class”=>”cmaApplication”,”label”=>”Membership Category”, “profile”=>”admins”, “required”=>false));
$fields[] = new PMProRH_Field(“SustainingMemberRep”, “select”, array(“class”=>”cmaApplicationSelect”,”label”=>”Is Sustaining Member Representative?”, “profile”=>”admins”, “required”=>false,”options”=>array(“No”=>”No”, “Yes”=>”Yes”)));
$fields[] = new PMProRH_Field(“Notes”, “textarea”, array(“class”=>”cmaApplication”,”label”=>”Notes”, “profile”=>”admins”, “required”=>false));

//add the fields into a new checkout_boxes are of the checkout page
foreach($fields as $field)
pmprorh_add_registration_field(“just_profile”, $field);

//Custom Registration Fields
$fields = array();

$fields[] = new PMProRH_Field(“company”, “text”, array(“class”=>”cmaApplication”, “profile”=>true, “required”=>false));
$fields[] = new PMProRH_Field(“company_Description”, “textarea”, array(“class”=>”cmaApplication”, “label”=>”Company Description”,”profile”=>true, “required”=>false));
$fields[] = new PMProRH_Field(“position”, “text”, array(“class”=>”cmaApplication”, “profile”=>true, “required”=>false));

$fields[] = new PMProRH_Field(“Mailing_Address”, “text”, array(“class”=>”cmaApplication”,”divclass”=>”cmaApplicationSection”,”label”=>”Mailing Address”, “profile”=>true, “required”=>false));
$fields[] = new PMProRH_Field(“City”, “text”, array(“class”=>”cmaApplication”, “label”=>”City”, “profile”=>true, “required”=>false));
$fields[] = new PMProRH_Field(“State”, “text”, array(“class”=>”cmaApplication”, “label”=>”State”, “profile”=>true, “required”=>false));
$fields[] = new PMProRH_Field(“Zip”, “text”, array(“class”=>”cmaApplication”,”label”=>”Zip”, “profile”=>true, “required”=>false));
$fields[] = new PMProRH_Field(“Country”, “text”, array(“class”=>”cmaApplication”,”label”=>”Country”, “profile”=>true, “required”=>false));

$fields[] = new PMProRH_Field(“Phone”, “text”, array(“class”=>”cmaApplication”,”divclass”=>”cmaApplicationSection”,”label”=>”Phone”, “profile”=>true, “required”=>false));
$fields[] = new PMProRH_Field(“Mobile”, “text”, array(“class”=>”cmaApplication”,”label”=>”Mobile”, “profile”=>true, “required”=>false));
$fields[] = new PMProRH_Field(“Fax”, “text”, array(“class”=>”cmaApplication”,”label”=>”Fax”, “profile”=>true, “required”=>false));

$fields[] = new PMProRH_Field(“Coal_Committee”, “select”, array(“class”=>”cmaApplicationSelect”,”divclass”=>”cmaApplicationSection”,”label”=>”Would you like to join the Coal Committee?”, “profile”=>true,”options”=>array(“No”=>”No”, “Yes”=>”Yes”)));
$fields[] = new PMProRH_Field(“HardRock_Committee”, “select”, array(“class”=>”cmaApplicationSelect”,”label”=>”Would you like to join the Hard Rock Committee?”, “profile”=>true,”options”=>array(“No”=>”No”, “Yes”=>”Yes”)));
$fields[] = new PMProRH_Field(“HealthSafety_Committee”, “select”, array(“class”=>”cmaApplicationSelect”,”label”=>”Would you like to join the Health & Safety Committee?”, “profile”=>true,”options”=>array(“No”=>”No”, “Yes”=>”Yes”)));
$fields[] = new PMProRH_Field(“International_Committee”, “select”, array(“class”=>”cmaApplicationSelect”,”label”=>”Would you like to join the International Committee?”, “profile”=>true,”options”=>array(“No”=>”No”, “Yes”=>”Yes”)));
$fields[] = new PMProRH_Field(“Outreach_Committee”, “select”, array(“class”=>”cmaApplicationSelect”,”label”=>”Would you like to join the Outreach Committee?”, “profile”=>true,”options”=>array(“No”=>”No”, “Yes”=>”Yes”)));
$fields[] = new PMProRH_Field(“Uranium_Committee”, “select”, array(“class”=>”cmaApplicationSelect”,”label”=>”Would you like to join the Uranium Committee?”, “profile”=>true,”options”=>array(“No”=>”No”, “Yes”=>”Yes”)));
$fields[] = new PMProRH_Field(“WaterQuality_Committee”, “select”, array(“class”=>”cmaApplicationSelect”,”label”=>”Would you like to join the Water Quality Committee?”, “profile”=>true,”options”=>array(“No”=>”No”, “Yes”=>”Yes”)));

//add the fields into a new checkout_boxes are of the checkout page
foreach($fields as $field)
pmprorh_add_registration_field(“checkout_boxes”, $field);

//that’s it. see the PMPro Register Helper readme for more information and examples.
}
add_action(“init”, “my_pmprorh_init”);

//remove event profile information
remove_action(‘show_user_profile’, ‘event_espresso_show_extra_profile_fields’);

/*
Add employer, title, and department columns to the members list CSV export.
Just add this code to your functions.php or a custom plugin.

The first function here defines the column headers and a callback function for each column.
*/
function my_pmpro_members_list_csv_extra_columns($columns)
{
$columns[“DateJoined”] = “DateJoined”;
$columns[“MemberNumber”] = “MemberNumber”;
$columns[“RenewalPaymentAmount”] = “RenewalPaymentAmount”;
$columns[“PaymentDate”] = “PaymentDate”;
$columns[“MBRYear”] = “MBRYear”;
$columns[“MembershipCategory”] = “MembershipCategory”;
$columns[“SustainingMemberRep”] = “SustainingMemberRep”;
$columns[“Notes”] = “Notes”;
$columns[“company”] = “company”;
$columns[“company_Description”] = “company_Description”;
$columns[“position”] = “position”;
$columns[“Mailing_Address”] = “Mailing_Address”;
$columns[“City”] = “City”;
$columns[“State”] = “State”;
$columns[“Zip”] = “Zip”;
$columns[“Country”] = “Country”;
$columns[“Phone”] = “Phone”;
$columns[“Mobile”] = “Mobile”;
$columns[“Fax”] = “Fax”;
$columns[“Coal_Committee”] = “Coal_Committee”;
$columns[“HardRock_Committee”] = “HardRock_Committee”;
$columns[“HealthSafety_Committee”] = “HealthSafety_Committee”;
$columns[“International_Committee”] = “International_Committee”;
$columns[“Outreach_Committee”] = “Outreach_Committee”;
$columns[“Uranium_Committee”] = “Uranium_Committee”;
$columns[“WaterQuality_Committee”] = “WaterQuality_Committee”;

return $columns;
}
add_filter(“pmpro_members_list_csv_extra_columns”, “my_pmpro_members_list_csv_extra_columns”, 10);

/*
These are the callback functions which take the $user object from the CSV code (which includes an array of meta data in ->metavalues, and returns the value you want.
I expanded the code for this first function for readability, but if you have a bunch of these, you may want to scrunch them up onto one line each.
*/
function DateJoined($user){if(!empty($user->metavalues->DateJoined)){return $user->metavalues->DateJoined;}else{return “”;}}
function MemberNumber($user){if(!empty($user->metavalues->MemberNumber)){return $user->metavalues->MemberNumber;}else{return “”;}}
function RenewalPaymentAmount($user){if(!empty($user->metavalues->RenewalPaymentAmount)){return $user->metavalues->RenewalPaymentAmount;}else{return “”;}}
function PaymentDate($user){if(!empty($user->metavalues->PaymentDate)){return $user->metavalues->PaymentDate;}else{return “”;}}
function MBRYear($user){if(!empty($user->metavalues->MBRYear)){return $user->metavalues->MBRYear;}else{return “”;}}
function MembershipCategory($user){if(!empty($user->metavalues->MembershipCategory)){return $user->metavalues->MembershipCategory;}else{return “”;}}
function SustainingMemberRep($user){if(!empty($user->metavalues->SustainingMemberRep)){return $user->metavalues->SustainingMemberRep;}else{return “”;}}
function Notes($user){if(!empty($user->metavalues->Notes)){return $user->metavalues->Notes;}else{return “”;}}
function company($user){if(!empty($user->metavalues->company)){return $user->metavalues->company;}else{return “”;}}
function company_Description($user){if(!empty($user->metavalues->company_Description)){return $user->metavalues->company_Description;}else{return “”;}}
function position($user){if(!empty($user->metavalues->position)){return $user->metavalues->position;}else{return “”;}}
function Mailing_Address($user){if(!empty($user->metavalues->Mailing_Address)){return $user->metavalues->Mailing_Address;}else{return “”;}}
function City($user){if(!empty($user->metavalues->City)){return $user->metavalues->City;}else{return “”;}}
function State($user){if(!empty($user->metavalues->State)){return $user->metavalues->State;}else{return “”;}}
function Zip($user){if(!empty($user->metavalues->Zip)){return $user->metavalues->Zip;}else{return “”;}}
function Country($user){if(!empty($user->metavalues->Country)){return $user->metavalues->Country;}else{return “”;}}
function Phone($user){if(!empty($user->metavalues->Phone)){return $user->metavalues->Phone;}else{return “”;}}
function Fax($user){if(!empty($user->metavalues->Fax)){return $user->metavalues->Fax;}else{return “”;}}
function Mobile($user){if(!empty($user->metavalues->Mobile)){return $user->metavalues->Mobile;}else{return “”;}}
function Coal_Committee($user){if(!empty($user->metavalues->Coal_Committee)){return $user->metavalues->Coal_Committee;}else{return “”;}}
function HardRock_Committee($user){if(!empty($user->metavalues->HardRock_Committee)){return $user->metavalues->HardRock_Committee;}else{return “”;}}
function HealthSafety_Committee($user){if(!empty($user->metavalues->HealthSafety_Committee)){return $user->metavalues->HealthSafety_Committee;}else{return “”;}}
function International_Committee($user){if(!empty($user->metavalues->International_Committee)){return $user->metavalues->International_Committee;}else{return “”;}}
function Outreach_Committee($user){if(!empty($user->metavalues->Outreach_Committee)){return $user->metavalues->Outreach_Committee;}else{return “”;}}
function Uranium_Committee($user){if(!empty($user->metavalues->Uranium_Committee)){return $user->metavalues->Uranium_Committee;}else{return “”;}}
function WaterQuality_Committee($user){if(!empty($user->metavalues->WaterQuality_Committee)){return $user->metavalues->WaterQuality_Committee;}else{return “”;}}

function ee_mer_change_event_list_url(){
return ‘https://www.coloradomining.org/events&#8217;;
}

add_filter( ‘FHEE__EED_Multi_Event_Registration__set_definitions__events_list_url’, ‘ee_mer_change_event_list_url’ );


Tony

  • Support Staff

November 11, 2015 at 3:17 am

Hi there,

Unfortunately that doesn’t point to the problem, the functions.php file is including multiple files so the function could also be in any of those:


require ( get_template_directory() . ‘/includes/functions.php’ );
require ( get_template_directory() . ‘/includes/hooks.php’ );
require ( get_template_directory() . ‘/includes/strap-extras.php’ );
require ( get_template_directory() . ‘/includes/sp-shortcodes.php’ );
require ( get_template_directory() . ‘/includes/cpt.php’ );

I would check if this happens on the latest version of the theme, you may want to this on a development version of the site as currently your functions.php file has custom code which will be lost when you update the theme (that should go in a Site Specific Plugin)

Can you send me a copy of the latest version of the theme? I’ll test to see if it the same happens using that version on a test site.

If so please send to suppoty[at]eventespresso.com and I’ll take a look.

(Note I can not guarantee a fix for this as it’s the theme doing something odd, but I will see if I can spot anything)


Jody Gibbs

November 18, 2015 at 3:42 pm

Hello,

I have the latest version of our theme but I am not sure how to send it to you – what is the best way? Can you send me an email address? It’s a 1MB zipped file.


Lorenzo Orlando Caum

  • Support Staff

November 18, 2015 at 6:23 pm

Hi Annette, please send it here and include a link to this support post:

support [at] eventespresso.com


Lorenzo


Tony

  • Support Staff

November 19, 2015 at 3:43 pm

Hi Annette,

I had a look over the files you sent and I’ve found the cause.

If you look within the themes files, within /includes/functions.php (not the one within the root directory) you’ll find this – http://take.ms/tXz7w

Its actually the whitespace between opening and closing PHP tags – http://take.ms/nukXQ

Basically it breaks the output of the CSV as its outputing content (which is nothing) to the page before the CSV headers have been sent.

Removing the whitespace fixes the problem – http://take.ms/14M2q

Or to do it properly, not have the opening and closing PHP tags – http://take.ms/HZ2CY

You may want to forward these details onto the theme author.

Viewing 12 reply threads

The support post ‘Problem – registrants export to html instead of csv file’ 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.

Event Espresso