[wp-trac] [WordPress Trac] #47509: add a filter in wp_user_personal_data_exporter() to make it easier to include additional user meta in a personal data export

WordPress Trac noreply at wordpress.org
Wed Jan 22 00:44:49 UTC 2020


#47509: add a filter in wp_user_personal_data_exporter() to make it easier to
include additional user meta in a personal data export
---------------------------------------------------+-----------------------
 Reporter:  pbiron                                 |       Owner:  xkon
     Type:  enhancement                            |      Status:  assigned
 Priority:  normal                                 |   Milestone:  5.4
Component:  Privacy                                |     Version:
 Severity:  normal                                 |  Resolution:
 Keywords:  has-patch 2nd-opinion has-screenshots  |     Focuses:
---------------------------------------------------+-----------------------

Comment (by pbiron):

 [https://core.trac.wordpress.org/attachment/ticket/47509/47509.2.diff
 47509.2.diff] updates
 [https://core.trac.wordpress.org/attachment/ticket/47509/47509.diff
 47509.diff], with the following changes:

 1. removes any item in the array returned by the filter that uses a `name`
 that core is already exporting.
 2. improves the DocBlock for the filter
 3. passes the user whose data is being exported to the filter (would be
 kind of hard for plugins to use the filter without that :-)
 4. passes an array of `$reserved_names`, instead of `$user_data_to_export`
 to the filter.  This makes it easier to document that any item returned
 that uses one of the `$reserved_names` will not be exported.
 5. calls `_doing_it_wrong()` if any items were removed.

 I'm still not sure whether number 5 is the correct thing to do.  I like
 the idea of it, but there don't seem to any other cases in core where
 `_doing_it_wrong()` is called when a filter returns results that aren't
 correct.  I'll leave it a committer to decide whether that is a correct
 usage of `_doing_it_wrong()`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47509#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list