Index: src/wp-admin/admin-ajax.php
===================================================================
--- src/wp-admin/admin-ajax.php	(revision 42806)
+++ src/wp-admin/admin-ajax.php	(working copy)
@@ -129,6 +129,7 @@
 	'get-post-thumbnail-html',
 	'get-community-events',
 	'edit-theme-plugin-file',
+	'wp-privacy-export-personal-data',
 );
 
 // Deprecated
Index: src/wp-admin/includes/ajax-actions.php
===================================================================
--- src/wp-admin/includes/ajax-actions.php	(revision 42806)
+++ src/wp-admin/includes/ajax-actions.php	(working copy)
@@ -4326,3 +4326,31 @@
 		);
 	}
 }
+
+function wp_ajax_wp_privacy_export_personal_data() {
+	$email_address = $_POST['email'];
+	$exporter_index = $_POST['exporter'];
+	$page = $_POST['page'];
+
+	$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
+
+	if ( ! is_email( $email_address ) ) {
+		wp_send_json_error( 'a valid email address must be given' );
+	}
+
+	if ( $exporter_index < 0 ) {
+		wp_send_json_error( 'exporter index cannot be negative' );
+	}
+
+	if ( $exporter_index > count( $exporters ) - 1 ) {
+		wp_send_json_error( 'exporter index out of range' );
+	}
+
+	if ( $page < 0 ) {
+		wp_send_json_error( 'page index cannot be negative' );
+	}
+
+	$response = call_user_func( $exporters[ $exporter_index ]['callback'], $email_address, $page );
+
+	wp_send_json_success( $response );
+}
Index: src/wp-admin/menu.php
===================================================================
--- src/wp-admin/menu.php	(revision 42806)
+++ src/wp-admin/menu.php	(working copy)
@@ -256,6 +256,7 @@
 	$submenu['tools.php'][5]  = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' );
 	$submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
 	$submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
+	$submenu['tools.php'][20] = array( __( 'Privacy' ), 'manage_options', 'tools-privacy.php' );
 if ( is_multisite() && ! is_main_site() ) {
 	$submenu['tools.php'][25] = array( __( 'Delete Site' ), 'delete_site', 'ms-delete-site.php' );
 }
Index: src/wp-admin/tools-privacy.php
===================================================================
--- src/wp-admin/tools-privacy.php	(nonexistent)
+++ src/wp-admin/tools-privacy.php	(working copy)
@@ -0,0 +1,334 @@
+<?php
+/**
+ * Privacy Policy Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'manage_options' ) ) {
+	wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) );
+}
+
+$title = __( 'Privacy Tools' );
+
+$action = isset( $_GET['action'] ) ? $_GET['action'] : '';
+
+$doing_personal_data_export_for_email = '';
+
+if ( ! empty( $action ) ) {
+	check_admin_referer( $action );
+
+	if ( 'set-privacy-page' === $action ) {
+		$privacy_policy_page_id = isset( $_POST['page_for_privacy_policy'] ) ? $_POST['page_for_privacy_policy'] : 0;
+		update_option( 'page_for_privacy_policy', $privacy_policy_page_id );
+		add_settings_error(
+			'page_for_privacy_policy',
+			'page_for_privacy_policy',
+			__( 'Privacy policy page updated successfully' ),
+			'updated'
+		);
+	}
+
+	if ( 'create-privacy-page' === $action ) {
+		$privacy_policy_page_id = wp_insert_post(
+			array(
+				'post_title'  => __( 'Privacy Policy' ),
+				'post_status' => 'publish',
+				'post_type'   => 'page',
+			),
+			true
+		);
+
+		if ( is_wp_error( $privacy_policy_page_id ) ) {
+			add_settings_error(
+				'page_for_privacy_policy',
+				'page_for_privacy_policy',
+				__( 'Unable to create privacy policy page' ),
+				'error'
+			);
+		} else {
+			update_option( 'page_for_privacy_policy', $privacy_policy_page_id );
+			add_settings_error(
+				'page_for_privacy_policy',
+				'page_for_privacy_policy',
+				__( 'Privacy policy page created successfully' ),
+				'updated'
+			);
+		}
+	}
+
+	if ( 'export-personal-data' === $action ) {
+
+		$username_or_email_address = isset( $_POST['username_or_email_to_export'] ) ? $_POST['username_or_email_to_export'] : '';
+		$username_or_email_address = sanitize_text_field( $username_or_email_address );
+
+		if ( ! is_email( $username_or_email_address ) ) {
+			$user = get_user_by( 'login', $username_or_email_address );
+			if ( ! $user instanceof WP_User ) {
+				add_settings_error(
+					'username_or_email_to_export',
+					'username_or_email_to_export',
+					__( 'Unable to export personal data. Username not recognized.' ),
+					'error'
+				);
+			} else {
+				$doing_personal_data_export_for_email = $user->user_email;
+			}
+		} else {
+			$doing_personal_data_export_for_email = $username_or_email_address;
+		}
+
+		if ( ! empty( $doing_personal_data_export_for_email ) ) {
+			$title = __( 'Export Personal Data' );
+		}
+	}
+}
+
+if ( empty( $doing_personal_data_export_for_email ) ) {
+	// If a privacy policy page ID is available, make sure the page actually exists. If not, display a warning
+	$privacy_policy_page_exists = false;
+	$privacy_policy_page_id = get_option( 'page_for_privacy_policy' );
+	if ( ! empty( $privacy_policy_page_id ) ) {
+			$privacy_policy_page = get_post( $privacy_policy_page_id );
+			if ( ! $privacy_policy_page instanceof WP_Post ) {
+				add_settings_error(
+					'page_for_privacy_policy',
+					'page_for_privacy_policy',
+					__( 'The currently selected privacy policy page does not exist' ),
+					'warning'
+				);
+			} else {
+				if ( 'trash' === $privacy_policy_page->post_status ) {
+					add_settings_error(
+						'page_for_privacy_policy',
+						'page_for_privacy_policy',
+						__( 'The currently selected privacy policy page is in the trash. Please select a new privacy policy page.' ),
+						'error'
+					);
+				} else {
+					$privacy_policy_page_exists = true;
+				}
+			}
+	}
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'privacy',
+		'title'   => __( 'Privacy' ),
+		'content' => '<p>' . __( 'This page provides tools with which you can manage your user\'s personal data and site\'s privacy policy.' ) . '</p>',
+	) );
+
+	get_current_screen()->set_help_sidebar(
+		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+		'<p>' . __( '<a href="#">Documentation on privacy</a>' ) . '</p>'
+	);
+}
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+?>
+<div class="wrap">
+	<h1><?php echo esc_html( $title ); ?></h1>
+	<?php settings_errors(); ?>
+<?php
+
+// Run the exporter
+if ( ! empty( $doing_personal_data_export_for_email ) ) {
+	if ( $username_or_email_address === $doing_personal_data_export_for_email ) {
+		$heading = sprintf(
+			__( 'Exporting personal data for %s' ),
+			$doing_personal_data_export_for_email
+		);
+	} else {
+		$heading = sprintf(
+			__( 'Exporting personal data for %1$s (%2$s)' ),
+			$doing_personal_data_export_for_email,
+			$username_or_email_address
+		);
+	}
+	?>
+	<p>
+		<?php echo esc_html( $heading ); ?>
+	</p>
+
+	<div id="exporters-container">
+		<ul id="exporter-list">
+		</ul>
+		<table class="wp-list-table widefat striped" id="exported-data-table">
+			<tr>
+				<th><?php _e( 'Name' ); ?></th>
+				<th><?php _e( 'Value' ); ?></th>
+			</tr>
+		</table>
+	</div>
+
+	<?php
+	// Build the array of exporters and emit it as an array accessible to javascript along with a nonce
+	$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
+
+	$exporter_names = array();
+	foreach ( ( array ) $exporters as $exporter ) {
+		$exporter_names[] = $exporter['exporter_friendly_name'];
+	}
+
+	?>
+
+	<!-- scripts for the exporter -->
+
+	<script>
+		( function( $ ) {
+			$( document ).ready( function() {
+				var exportForEmail = <?php echo json_encode( $doing_personal_data_export_for_email ); ?>;
+				var exporterNames = <?php echo json_encode( $exporter_names ); ?>;
+				var successMessage = "<?php echo esc_attr( __( 'Export completed successfully' ) ); ?>";
+				var failureMessage = "<?php echo esc_attr( __( 'A failure occurred during export' ) ); ?>";
+
+				function on_exports_done_success() {
+					$( '#exporters-container' ).append( '<p>' + successMessage + '</p>' );
+				}
+
+				function on_export_failure( textStatus, error ) {
+					$( '#exporters-container' ).append( '<p>' + failureMessage + '</p>' );
+					$( '#exporters-container' ).append( '<p>' + textStatus + '</p>' );
+				}
+
+				function do_next_export( exporterIndex, pageIndex ) {
+					$.ajax( {
+						url: ajaxurl,
+						data: {
+							action: 'wp-privacy-export-personal-data',
+							email: exportForEmail,
+							exporter: exporterIndex,
+							page: pageIndex
+						},
+						method: 'post'
+					} ).done( function( response ) {
+						var responseData = response.data;
+						for ( var dataIndex = 0; dataIndex < responseData.data.length; dataIndex++ ) {
+							$( '#exported-data-table' ).append( '<tr><td>' + responseData.data[ dataIndex ].name + '</td><td>' + responseData.data[ dataIndex ].value + '</td></tr>' );
+						}
+						if ( ! responseData.done ) {
+							setTimeout( do_next_export( exporterIndex, pageIndex + 1 ) );
+						} else {
+							if ( exporterIndex < exporterNames.length - 1 ) {
+								setTimeout( do_next_export( exporterIndex + 1, 0 ) );
+							} else {
+								on_exports_done_success();
+							}
+						}
+					} ).fail( function( jqxhr, textStatus, error ) {
+						on_export_failure( textStatus, error );
+					} );
+				}
+
+				// And now, let's begin
+				do_next_export( 0, 0 );
+			} )
+		} ) ( jQuery );
+	</script>
+
+	<p>
+		<a href="tools-privacy.php"><?php esc_html_e( 'Return to privacy tools' ); ?></a>
+	</p>
+	<?php
+}
+
+// Display the privacy tools form table
+if ( empty( $doing_personal_data_export_for_email ) ) {
+	?>
+	<table class="form-table">
+		<tr>
+			<th scope="row"><?php _e( 'Privacy policy page' ); ?></th>
+			<td id="privacy-page-form-container">
+				<form method="post" action="tools-privacy.php?action=set-privacy-page">
+					<?php wp_nonce_field( 'set-privacy-page' ); ?>
+					<fieldset>
+						<legend class="screen-reader-text"><span><?php _e( 'Privacy policy page' ); ?></span></legend>
+						<label for="page_for_privacy_policy">
+							<?php wp_dropdown_pages(
+								array(
+									'name'              => 'page_for_privacy_policy',
+									'show_option_none'  => __( '&mdash; Select &mdash;' ),
+									'option_none_value' => '0',
+									'selected'          => get_option( 'page_for_privacy_policy' ),
+								)
+							);
+							?>
+						</label>
+					</fieldset>
+					<?php submit_button( __( 'Set Page' ) ); ?>
+				</form>
+				<?php
+					if ( empty( $privacy_policy_page_id ) ) {
+						?>
+						<form method="post" action="tools-privacy.php?action=create-privacy-page">
+							<?php wp_nonce_field( 'create-privacy-page' ); ?>
+							<p>
+								<?php _e( 'If you don\'t already have a page for your privacy policy, you can create one now' ); ?>
+							</p>
+							<?php submit_button( __( 'Create Page' ) ); ?>
+						</form>
+						<?php
+					}
+					if( $privacy_policy_page_exists ) {
+						$edit_href = add_query_arg(
+							array(
+								'post'  => $privacy_policy_page_id,
+								'action' => 'edit',
+							),
+							admin_url( 'post.php' )
+						);
+						$view_href = get_permalink( $privacy_policy_page_id );
+						$prompt = sprintf(
+							__( 'You may also <a href="%1$s">edit</a> or <a href="%2$s">view</a> your privacy policy page' ),
+							$edit_href,
+							$view_href
+						);
+						$allowed_html = array( 'a' => array( 'href' => array() ) );
+						?>
+						<p class="description" id="page_for_privacy_policy_view_edit">
+							<?php echo wp_kses( $prompt, $allowed_html ); ?>
+						</p>
+						<?php
+					}
+				?>
+			</td>
+		</tr>
+		<tr>
+			<th scope="row"><?php _e( 'Export personal data' ); ?></th>
+			<td id="export-personal-data-form-container">
+				<form method="post" action="tools-privacy.php?action=export-personal-data">
+					<?php wp_nonce_field( 'export-personal-data' ); ?>
+					<fieldset>
+						<legend class="screen-reader-text"><span><?php _e( 'Enter the username or email address of the user whose personal data you wish to export' ); ?></span></legend>
+						<label for="username_or_email_to_export">
+							<input type="text" class="regular-text" name="username_or_email_to_export" />
+						</label>
+						<p class="description"><?php _e( 'The username or email address of the user whose personal data you wish to export' ); ?></p>
+					</fieldset>
+					<?php submit_button( __( 'Begin Export' ) ); ?>
+				</form>
+			</td>
+		</tr>
+	</table>
+	<!-- scripts for the privacy form table content -->
+	<script>
+		( function( $ ) {
+			$( document ).ready( function() {
+				$( '#page_for_privacy_policy' ).change( function() {
+					$( '#page_for_privacy_policy_view_edit' ).hide();
+				} );
+			} );
+		} ( jQuery ) );
+	</script>
+<?php
+}
+?>
+
+</div>
+<?php
+
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: src/wp-includes/comment.php
===================================================================
--- src/wp-includes/comment.php	(revision 42806)
+++ src/wp-includes/comment.php	(working copy)
@@ -3274,3 +3274,76 @@
 
 	return get_comment( $comment_id );
 }
+
+/**
+ * Registers the personal data exporter for comments
+ *
+ * @param array   $exporters   An array of personal data exporters.
+ * @return array  An array of personal data exporters.
+ */
+function wp_register_comment_personal_data_exporter( $exporters ) {
+	$exporters[] = array(
+		'exporter_friendly_name' => __( 'WordPress Comments' ),
+		'callback' => 'wp_comments_personal_data_exporter'
+	);
+
+	return $exporters;
+}
+
+/**
+ * Finds and exports data which could be used to identify a person from comments assocated with an email address.
+ *
+ * @param string  $email  The comment author email address.
+ * @param int     $page   Comment page.
+ * @return array  An array of personal data in name value pairs
+ */
+function wp_comments_personal_data_exporter( $email_address, $page ) {
+
+	$personal_data = array();
+	$email_address = trim( strtolower( $email_address ) );
+
+	// TODO - actually use the page parameter to avoid fetching all the comments at once
+	// that will be a no-no on sites with lots of comments
+
+	// TODO - pass the email address to get_comments if possible to be most performant
+
+	$comments = get_comments(
+		array(
+			'order_by' => 'comment_ID',
+			'order' => 'ASC'
+		)
+	);
+
+	$comment_personal_data_props = array(
+		'comment_author'       => __( 'Comment Author' ),
+		'comment_author_email' => __( 'Comment Author Email' ),
+		'comment_author_url'   => __( 'Comment Author URL' ),
+		'comment_author_IP'    => __( 'Comment Author IP' ),
+		'comment_agent'        => __( 'Comment Agent' )
+	);
+
+	foreach ( (array) $comments as $comment ) {
+		$comment_author_email = trim( strtolower( $comment->comment_author_email ) );
+		if ( $comment_author_email === $email_address ) {
+			foreach ( (array) $comment_personal_data_props as $key => $description ) {
+				$value = $comment->$key;
+				if ( ! empty( $value ) ) {
+					$name = sprintf(
+						__( 'Comment %d : %s' ),
+						$comment->comment_ID,
+						$description
+					);
+					$personal_data[] = array(
+						'name'  => $name,
+						'value' => $value
+					);
+				}
+			}
+		}
+	}
+
+	return array(
+		'data' => $personal_data,
+		'done' => true,
+	);
+}
Index: src/wp-includes/default-filters.php
===================================================================
--- src/wp-includes/default-filters.php	(revision 42806)
+++ src/wp-includes/default-filters.php	(working copy)
@@ -328,6 +328,7 @@
 add_action( 'do_pings', 'do_all_pings', 10, 1 );
 add_action( 'do_robots', 'do_robots' );
 add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 );
+add_filter( 'wp_privacy_personal_data_exporters', 'wp_register_comment_personal_data_exporter', 10 );
 add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' );
 add_action( 'admin_print_scripts', 'print_emoji_detection_script' );
 add_action( 'admin_print_scripts', 'print_head_scripts', 20 );
