GDPR icon indicating copy to clipboard operation
GDPR copied to clipboard

Customize export data

Open vptcnt opened this issue 7 years ago • 1 comments

Hello,

I would like to customize the export data :

  • rewrite the tag 'Metadata'
  • add some new data

There is a filters call :

$extra_content = apply_filters( 'gdpr_export_data_extra_tables', '', $email );

But impossible to define 2 filters :

add_filter('gdpr_export_data_extra_tables', function($empty, $email) {
  return array('name' => 'test 1', 'content' => 'data 1');
}, 10, 2);
add_filter('gdpr_export_data_extra_tables', function($empty, $email) {
  return array('name' => 'test 2', 'content' => 'data 2');
}, 11, 2);

Only the 'TEST 2' is taken...

Maybe will it be best to call a filter after the first array initialization. Means replace the line :

if ( $extra_content ) {
  $json[ $extra_content['name'] ] = $extra_content['content'];
}

by

$json = apply_filters( 'gdpr_export_data_extra_tables', $json, $email );

So we can have access to all the json data...

Vincent

vptcnt avatar May 16 '18 22:05 vptcnt

Thank you Vincent. I will make the adjustment for the next release.

fclaussen avatar May 17 '18 14:05 fclaussen