[wp-trac] [WordPress Trac] #43438: Export registered user's personal data on request
WordPress Trac
noreply at wordpress.org
Fri Mar 9 13:29:52 UTC 2018
#43438: Export registered user's personal data on request
------------------------------+------------------
Reporter: azaozz | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: General | Version:
Severity: normal | Resolution:
Keywords: gdpr needs-patch | Focuses:
------------------------------+------------------
Comment (by jesperher):
@allendav The method of just using a filter, is not far away from my
current code, and was infact the first thought of how to approach this.
I can change my code to do the filter/array method istead but i am hitting
an dead end. And can see it still will be an issue even when using the
filter/array method.
when we are calling 1 callback at a time, the $variabel who contains all
the callbacks, from the
´wp_privacy_register_export_data_callback´ filter.
when this is going into the javascript, the instance of the objects used
to inform the callbacks dies.
example:
--Random plugin--
´´´
add_filter( "wp_privacy_register_export_data_callback", array( $this,
'register_export_data_callback' ) );
function register_export_data_callback( $export_callbacks ) {
$export_callbacks[] = array(
'slug' => 'stripe',
'plugin_friendly_name' => __( 'Stripe Payments for WooCommerce' ),
'callback' => array( $this, 'export_data' )
);
return $export_callbacks;
}
$all_callbacks =
apply_filters('wp_privacy_register_export_data_callback',array() );
localize_script.... $all_callbacs
´´´
The $this, object dies as it goes into the javascript.
if creating Ajax call, and sending the 'callback' => array( $this,
'export_data' )´ to REST endpoint, "$this" doesnt work anymore, and using
the ´call_user_func´ wont work.
A "solution" (but not a good one) would be to build "$all_callbacks" in
every callback, and call the specific callback by index.
Do you have any thought on how to get around this issue.?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43438#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list