Support

Home Forums Event Espresso Premium Exported CSV Fields – Fixing Lettering Format

Exported CSV Fields – Fixing Lettering Format

Posted: January 9, 2019 at 2:19 pm


gdtech

January 9, 2019 at 2:19 pm

I’d like to have the end-user type in all caps or at least upper case the first letter of their name fields, etc. I know I can accomplish this with some CSS magic but the problem is that I need the exported data dump csv file to reflect this and don’t want to have to fix this later in Excel. Is there any way to have the database accomplish this?


Tony

  • Support Staff

January 10, 2019 at 7:41 am

Hi there,

The quickest way to achieve this is to just change all of the strings to uppercase when exporting the CSV, that will leave all of the values however the user inputs them in EE but on export, you get the values in uppercase.

You can do that with a snippet like this:

https://gist.github.com/Pebblo/59af08753b201dbabd70a8b04217d783

You can add that to a custom functions plugin on your site, we have some documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


gdtech

January 10, 2019 at 12:34 pm

That is great. I made some slight modifications and am very happy with this:

//Please do not include the opening PHP tag if you already have one.
function tw_ee_espresso_reg_report_filter_columns_ucwords( $csv_row){
	foreach($csv_row as $key => $value) {
		$csv_row[$key] = ucwords($value);
	}
	return $csv_row;
}
add_filter( 'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array', 'tw_ee_espresso_reg_report_filter_columns_ucwords', 999, 1);

However, can you specify the “Email Address” field to be lower case? If not, it’s ok. Thanks!


Tony

  • Support Staff

January 11, 2019 at 3:29 am

Just to note, in your opening post you have:

I’d like to have the end-user type in all caps or at least upper case the first letter of their name fields

All caps being preferred would use strtoupper(), first letter of each word can use ucwords().

Either is fine just noting for any other users.

However, can you specify the “Email Address” field to be lower case? If not, it’s ok. Thanks!

Sure, just check $key within the for each before running function:

if( $key !== 'Email Address' ) {
    $csv_row[$key] = ucwords($value);
}

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: publish

Updated by  Tony 1 week, 1 day ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!