Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add Register Helper File Upload Field to Member's CSV Export
<?php
/**
* Add the full URL of a file upload field to member export CSV.
* Adjust the 'my_image' value with the relevant Register Helper field key.
* You can add this code snippet to your WordPress site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// Add a custom column to the CSV export.
function my_pmpro_members_list_csv_extra_columns ( $columns ) {
$columns["uploaded"] = "my_pmpro_members_list_uploaded";
return $columns;
}
add_filter( 'pmpro_members_list_csv_extra_columns', 'my_pmpro_members_list_csv_extra_columns', 10 );
// Callback to get the value.
function my_pmpro_members_list_uploaded ( $user ) {
$uploaded_value = get_user_meta( $user->ID, 'my_image', true ); // change 'my_image' to the file upload field meta key from Register Helper
if ( is_array( $uploaded_value ) ) {
$uploaded_value = $uploaded_value['fullurl'];
}
return $uploaded_value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment