Privacy: Store plugin callbacks in associative array for flexibility.

The personal data export and erasure tools allow plugins to register their own callbacks, in order to add additional data to the export and erasure processes. Previously, these were registered without specifying a constant identifier in the array of callbacks. Using mutable integers makes it difficult for plugins to modify the callbacks of other plugins, though.

Using associative array keys instead provides a covenient and reliable way to identify and interact with another plugin's callbacks.

Props desrosj, allendav, ocean90.
Fixes #43931.


git-svn-id: https://develop.svn.wordpress.org/trunk@43154 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ian Dunn
2018-05-03 19:27:14 +00:00
parent 7cca1e9cad
commit 4bb19e4aca
6 changed files with 26 additions and 23 deletions

View File

@@ -2834,7 +2834,7 @@ function _wp_privacy_action_request_types() {
* @return array An array of personal data exporters.
*/
function wp_register_user_personal_data_exporter( $exporters ) {
$exporters[] = array(
$exporters['wordpress-user'] = array(
'exporter_friendly_name' => __( 'WordPress User' ),
'callback' => 'wp_user_personal_data_exporter',
);