<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][12272] trunk/src: Privacy: Introduce 'Export Data' settings panel.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/12272">12272</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/12272","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>boonebgorges</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-11-02 14:17:03 +0000 (Fri, 02 Nov 2018)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Privacy: Introduce 'Export Data' settings panel.

This new panel allows users to request a data export. It also has
information on deleting one's personal data, which in BuddyPress means
deleting one's account.

Props r-a-y.
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/7826">#7826</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpsettingsbpsettingsfunctionsphp">trunk/src/bp-settings/bp-settings-functions.php</a></li>
<li><a href="#trunksrcbpsettingsclassesclassbpsettingscomponentphp">trunk/src/bp-settings/classes/class-bp-settings-component.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacybuddypressmemberssinglesettingsphp">trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaubuddypressmemberssinglesettingsdeleteaccountphp">trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/delete-account.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaubuddypressmemberssinglesettingsphp">trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcbpsettingsactionsdataphp">trunk/src/bp-settings/actions/data.php</a></li>
<li><a href="#trunksrcbpsettingsscreensdataphp">trunk/src/bp-settings/screens/data.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacybuddypressmemberssinglesettingsdataphp">trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/data.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaubuddypressmemberssinglesettingsdataphp">trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/data.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpsettingsactionsdataphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-settings/actions/data.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-settings/actions/data.php                            (rev 0)
+++ trunk/src/bp-settings/actions/data.php      2018-11-02 14:17:03 UTC (rev 12272)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,69 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Settings: Data management action handler
+ *
+ * @package BuddyPress
+ * @subpackage SettingsActions
+ * @since 4.0.0
+ */
+
+/**
+ * Data export request handler.
+ *
+ * @since 4.0.0
+ */
+function bp_settings_action_data() {
+       if ( ! bp_is_post_request() || ! bp_displayed_user_id() || empty( $_POST['bp-data-export-nonce'] ) ) {
+               return;
+       }
+
+       // Nonce check.
+       check_admin_referer( 'bp-data-export', 'bp-data-export-nonce' );
+
+       // Delete existing request if available.
+       if ( ! empty( $_POST['bp-data-export-delete-request-nonce'] ) && wp_verify_nonce( $_POST['bp-data-export-delete-request-nonce'], 'bp-data-export-delete-request' ) ) {
+               $existing = bp_settings_get_personal_data_request();
+               if ( ! empty( $existing->ID ) ) {
+                       wp_delete_post( $existing->ID, true );
+               }
+       }
+
+       // Create the user request.
+       $request_id = wp_create_user_request( buddypress()->displayed_user->userdata->user_email, 'export_personal_data' );
+
+       $success = true;
+       if ( is_wp_error( $request_id ) ) {
+               $success = false;
+               $message = $request_id->get_error_message();
+       } elseif ( ! $request_id ) {
+               $success = false;
+               $message = __( 'We were unable to generate the data export request.', 'buddypress' );
+       }
+
+       /*
+        * Auto-confirm the user request since the user already consented by
+        * submitting our form.
+        */
+       if ( $success ) {
+               /** This hook is documented in /wp-login.php */
+               do_action( 'user_request_action_confirmed', $request_id );
+
+               $message = __( 'Data export request successfully created', 'buddypress' );
+       }
+
+       /**
+        * Fires after a user has created a data export request.
+        *
+        * This hook can be used to intervene in the data export request process.
+        *
+        * @since 4.0.0
+        *
+        * @param int  $request_id ID of the request.
+        * @param bool $success    Whether the request was successfully created by WordPress.
+        */
+       do_action( 'bp_user_data_export_requested', $request_id, $success );
+
+       bp_core_add_message( $message, $success ? 'success' : 'error' );
+       bp_core_redirect( bp_get_requested_url() );
+}
+add_action( 'bp_actions', 'bp_settings_action_data' );
</ins></span></pre></div>
<a id="trunksrcbpsettingsbpsettingsfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-settings/bp-settings-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-settings/bp-settings-functions.php   2018-11-02 13:16:25 UTC (rev 12271)
+++ trunk/src/bp-settings/bp-settings-functions.php     2018-11-02 14:17:03 UTC (rev 12272)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -215,3 +215,133 @@
</span><span class="cx" style="display: block; padding: 0 10px">                'done' => true,
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Fetches a user's personal data request.
+ *
+ * @since 4.0.0
+ *
+ * @param int WP user ID.
+ * @return WP_User_Request|false WP_User_Request object on success, boolean false on failure.
+ */
+function bp_settings_get_personal_data_request( $user_id = 0 ) {
+       if ( empty( $user_id ) ) {
+               $user_id = bp_displayed_user_id();
+       }
+
+       if ( empty( $user_id ) ) {
+               return false;
+       }
+
+       $user = get_userdata( $user_id );
+       if ( empty( $user ) ) {
+               return false;
+       }
+
+       $query = new WP_Query( array(
+               'author'        => (int) $user_id,
+               'post_type'     => 'user_request',
+               'post_status'   => 'any',
+               'post_name__in' => array(
+                       'export_personal_data',
+               ),
+       ) );
+
+       if ( ! empty( $query->post ) ) {
+               return wp_get_user_request_data( $query->post->ID );
+       } else {
+               return false;
+       }
+}
+
+/**
+ * Fetches the expiration date for when a user request expires.
+ *
+ * @since 4.0.0
+ *
+ * @param WP_User_Request $request User request object.
+ * @return string Formatted date.
+ */
+function bp_settings_get_personal_data_expiration_date( WP_User_Request $request ) {
+       /** This filter is documented in wp-admin/includes/file.php */
+       $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
+
+       return bp_format_time( $request->completed_timestamp + $expiration, true );
+}
+
+/**
+ * Fetches the confirmation date for a user request object.
+ *
+ * @since 4.0.0
+ *
+ * @param WP_User_Request $request User request object.
+ * @return string Formatted date for the confirmation date.
+ */
+function bp_settings_get_personal_data_confirmation_date( WP_User_Request $request ) {
+       return bp_format_time( $request->confirmed_timestamp, true );
+}
+
+/**
+ * Fetches the URL for a personal data export file.
+ *
+ * @since 4.0.0
+ *
+ * @param WP_User_Request $request User request object.
+ * @return string Export file URL.
+ */
+function bp_settings_get_personal_data_export_url( WP_User_Request $request ) {
+       return get_post_meta( $request->ID, '_export_file_url', true );
+}
+
+/**
+ * Check if the generated data export file still exists or not.
+ *
+ * @since 4.0.0
+ *
+ * @param  WP_User_Request $request User request object.
+ * @return bool
+ */
+function bp_settings_personal_data_export_exists( WP_User_Request $request ) {
+       $file = get_post_meta( $request->ID, '_export_file_path', true );
+       if ( file_exists( $file ) ) {
+               return true;
+       } else {
+               return false;
+       }
+}
+
+/**
+ * Template tag to output a list of data exporter items.
+ *
+ * Piggybacks off of the 'wp_privacy_personal_data_exporters' filter and the
+ * 'exporter_friendly_name' key, which is meant for the admin area.
+ *
+ * @todo We should look for a custom key like 'exporter_frontend_name' if available.
+ *
+ * @since 4.0.0
+ */
+function bp_settings_data_exporter_items() {
+       /** This filter is documented in /wp-admin/includes/ajax-actions.php */
+       $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
+
+?>
+       <ul>
+       <?php foreach ( $exporters as $exporter => $data ) :
+               /**
+                * Filters the data exporter name for display on the "Settings > Data" page.
+                *
+                * @since 4.0.0
+                *
+                * @param string $name     Data exporter friendly name.
+                * @param string $exporter Internal exporter name.
+                */
+               $item = apply_filters( 'bp_settings_data_exporter_name', esc_html( $data['exporter_friendly_name'] ), $exporter );
+       ?>
+
+               <li><?php echo $item; ?></li>
+
+       <?php endforeach; ?>
+       </ul>
+
+<?php
+}
</ins></span></pre></div>
<a id="trunksrcbpsettingsclassesclassbpsettingscomponentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-settings/classes/class-bp-settings-component.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-settings/classes/class-bp-settings-component.php     2018-11-02 13:16:25 UTC (rev 12271)
+++ trunk/src/bp-settings/classes/class-bp-settings-component.php       2018-11-02 14:17:03 UTC (rev 12272)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -66,7 +66,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $actions = array( 'notifications', 'capabilities', 'delete-account' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $actions = array( 'notifications', 'capabilities', 'data', 'delete-account' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Authenticated actions.
</span><span class="cx" style="display: block; padding: 0 10px">                if ( is_user_logged_in() ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -183,6 +183,28 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                /**
+                * Filter whether the site should show the "Settings > Data" page.
+                *
+                * @since 4.0.0
+                *
+                * @param bool $show Defaults to true.
+                */
+               $show_data_page = apply_filters( 'bp_settings_show_user_data_page', true );
+
+               // Export Data - only available for WP 4.9.6+.
+               if ( true === $show_data_page && version_compare( $GLOBALS['wp_version'], '4.9.6', '>=' ) ) {
+                       $sub_nav[] = array(
+                               'name'            => __( 'Export Data', 'buddypress' ),
+                               'slug'            => 'data',
+                               'parent_url'      => $settings_link,
+                               'parent_slug'     => $slug,
+                               'screen_function' => 'bp_settings_screen_data',
+                               'position'        => 89,
+                               'user_has_access' => $access,
+                       );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 // Add Delete Account nav item.
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ( ! bp_disable_account_deletion() && bp_is_my_profile() ) || bp_current_user_can( 'delete_users' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $sub_nav[] = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -242,6 +264,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        /** This filter is documented in bp-settings/classes/class-bp-settings-component.php */
+                       $show_data_page = apply_filters( 'bp_settings_show_user_data_page', true );
+
+                       // Export Data.
+                       if ( true === $show_data_page && version_compare( $GLOBALS['wp_version'], '4.9.6', '>=' ) ) {
+                               $wp_admin_nav[] = array(
+                                       'parent'   => 'my-account-' . $this->id,
+                                       'id'       => 'my-account-' . $this->id . '-data',
+                                       'title'    => __( 'Export Data', 'buddypress' ),
+                                       'href'     => trailingslashit( $settings_link . 'data' ),
+                                       'position' => 89,
+                               );
+                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         // Delete Account
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( !bp_current_user_can( 'bp_moderate' ) && ! bp_core_get_root_option( 'bp-disable-account-deletion' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                $wp_admin_nav[] = array(
</span></span></pre></div>
<a id="trunksrcbpsettingsscreensdataphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-settings/screens/data.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-settings/screens/data.php                            (rev 0)
+++ trunk/src/bp-settings/screens/data.php      2018-11-02 14:17:03 UTC (rev 12272)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,29 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Settings: User's "Settings > Export Data" screen handler
+ *
+ * @package BuddyPress
+ * @subpackage SettingsScreens
+ * @since 4.0.0
+ */
+
+/**
+ * Show the data settings template.
+ *
+ * @since 4.0.0
+ */
+function bp_settings_screen_data() {
+       if ( bp_action_variables() ) {
+               bp_do_404();
+               return;
+       }
+
+       /**
+        * Filters the template file path to use for the data settings screen.
+        *
+        * @since 4.0.0
+        *
+        * @param string $value Directory path to look in for the template file.
+        */
+       bp_core_load_template( apply_filters( 'bp_settings_screen_data', 'members/single/settings/data' ) );
+}
</ins></span></pre></div>
<a id="trunksrcbptemplatesbplegacybuddypressmemberssinglesettingsdataphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/data.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/data.php                              (rev 0)
+++ trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/data.php        2018-11-02 14:17:03 UTC (rev 12272)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,79 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * BuddyPress - Members Settings Data
+ *
+ * @package BuddyPress
+ * @subpackage bp-legacy
+ * @version 4.0.0
+ */
+
+/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/settings/profile.php */
+do_action( 'bp_before_member_settings_template' ); ?>
+
+<h2><?php _e( 'Data Export', 'buddypress' );?></h2>
+
+<?php $request = bp_settings_get_personal_data_request(); ?>
+
+<?php if ( $request ) : ?>
+
+       <?php if ( 'request-completed' === $request->status ) : ?>
+
+               <?php if ( bp_settings_personal_data_export_exists( $request ) ) : ?>
+
+                       <p><?php esc_html_e( 'Your request for an export of personal data has been completed.', 'buddypress' ); ?></p>
+                       <p><?php printf( esc_html__( 'You may download your personal data by clicking on the link below. For privacy and security, we will automatically delete the file on %s, so please download it before then.', 'buddypress' ), bp_settings_get_personal_data_expiration_date( $request ) ); ?></p>
+
+                       <p><strong><?php printf( '<a href="%1$s">%2$s</a>', bp_settings_get_personal_data_export_url( $request ), esc_html__( 'Download personal data', 'buddypress' ) ); ?></strong></p>
+
+               <?php else : ?>
+
+                       <p><?php esc_html_e( 'Your previous request for an export of personal data has expired.', 'buddypress' ); ?></p>
+                       <p><?php esc_html_e( 'Please click on the button below to make a new request.', 'buddypress' ); ?></p>
+
+                       <form id="bp-data-export" method="post">
+                               <input type="hidden" name="bp-data-export-delete-request-nonce" value="<?php echo wp_create_nonce( 'bp-data-export-delete-request' ); ?>" />
+                               <button type="submit" name="bp-data-export-nonce" value="<?php echo wp_create_nonce( 'bp-data-export' ); ?>"><?php esc_html_e( 'Request new data export', 'buddypress' ); ?></button>
+                       </form>
+
+               <?php endif; ?>
+
+       <?php elseif ( 'request-confirmed' === $request->status ) : ?>
+
+               <p><?php printf( esc_html__( 'You previously requested an export of your personal data on %s.', 'buddypress' ), bp_settings_get_personal_data_confirmation_date( $request ) ); ?></p>
+               <p><?php esc_html_e( 'You will receive a link to download your export via email once we are able to fulfill your request.', 'buddypress' ); ?></p>
+
+       <?php endif; ?>
+
+<?php else : ?>
+
+       <p><?php esc_html_e( 'You can request an export of your personal data, containing the following items if applicable:', 'buddypress' ); ?></p>
+
+       <?php bp_settings_data_exporter_items(); ?>
+
+       <p><?php esc_html_e( 'If you want to make a request, please click on the button below:', 'buddypress' ); ?></p>
+
+       <form id="bp-data-export" method="post">
+               <button type="submit" name="bp-data-export-nonce" value="<?php echo wp_create_nonce( 'bp-data-export' ); ?>"><?php esc_html_e( 'Request personal data export', 'buddypress' ); ?></button>
+       </form>
+
+<?php endif; ?>
+
+<!--
+<h2 class="bp-screen-reader-text"><?php
+       /* translators: accessibility text */
+       _e( 'Data Erase', 'buddypress' );
+?></h2>
+
+<p>You can make a request to erase the following type of data from the site:</p>
+
+<p>If you want to make a request, please click on the button below:</p>
+
+       <form id="bp-data-erase" method="post">
+               <button type="submit" name="bp-data-erase-nonce" value="<?php echo wp_create_nonce( 'bp-data-erase' ); ?>">Request data erasure</button>
+       </form>
+-->
+
+<?php
+
+/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/settings/profile.php */
+do_action( 'bp_after_member_settings_template' );
</ins></span></pre></div>
<a id="trunksrcbptemplatesbplegacybuddypressmemberssinglesettingsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings.php   2018-11-02 13:16:25 UTC (rev 12271)
+++ trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings.php     2018-11-02 14:17:03 UTC (rev 12272)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,6 +37,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">        case 'profile'        :
</span><span class="cx" style="display: block; padding: 0 10px">                bp_get_template_part( 'members/single/settings/profile'        );
</span><span class="cx" style="display: block; padding: 0 10px">                break;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        case 'data'           :
+               bp_get_template_part( 'members/single/settings/data'           );
+               break;
</ins><span class="cx" style="display: block; padding: 0 10px">         default:
</span><span class="cx" style="display: block; padding: 0 10px">                bp_get_template_part( 'members/single/plugins'                 );
</span><span class="cx" style="display: block; padding: 0 10px">                break;
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaubuddypressmemberssinglesettingsdataphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/data.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/data.php                             (rev 0)
+++ trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/data.php       2018-11-02 14:17:03 UTC (rev 12272)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,69 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * BuddyPress - Members Settings (Export Data)
+ *
+ * @since 3.1.0
+ * @version 3.1.0
+ */
+
+bp_nouveau_member_hook( 'before', 'settings_template' ); ?>
+
+<h2 class="screen-heading data-settings-screen">
+       <?php esc_html_e( 'Data Export', 'buddypress' ); ?>
+</h2>
+
+<?php $request = bp_settings_get_personal_data_request(); ?>
+
+<?php if ( $request ) : ?>
+
+       <?php if ( 'request-completed' === $request->status ) : ?>
+
+               <?php if ( bp_settings_personal_data_export_exists( $request ) ) : ?>
+
+                       <p><?php esc_html_e( 'Your request for an export of personal data has been completed.', 'buddypress' ); ?></p>
+                       <p><?php printf( esc_html__( 'You may download your personal data by clicking on the link below. For privacy and security, we will automatically delete the file on %s, so please download it before then.', 'buddypress' ), bp_settings_get_personal_data_expiration_date( $request ) ); ?></p>
+
+                       <p><strong><?php printf( '<a href="%1$s">%2$s</a>', bp_settings_get_personal_data_export_url( $request ), esc_html__( 'Download personal data', 'buddypress' ) ); ?></strong></p>
+
+               <?php else : ?>
+
+                       <p><?php esc_html_e( 'Your previous request for an export of personal data has expired.', 'buddypress' ); ?></p>
+                       <p><?php esc_html_e( 'Please click on the button below to make a new request.', 'buddypress' ); ?></p>
+
+                       <form id="bp-data-export" method="post">
+                               <input type="hidden" name="bp-data-export-delete-request-nonce" value="<?php echo wp_create_nonce( 'bp-data-export-delete-request' ); ?>" />
+                               <button type="submit" name="bp-data-export-nonce" value="<?php echo wp_create_nonce( 'bp-data-export' ); ?>"><?php esc_html_e( 'Request new data export', 'buddypress' ); ?></button>
+                       </form>
+
+               <?php endif; ?>
+
+       <?php elseif ( 'request-confirmed' === $request->status ) : ?>
+
+               <p><?php printf( esc_html__( 'You previously requested an export of your personal data on %s.', 'buddypress' ), bp_settings_get_personal_data_confirmation_date( $request ) ); ?></p>
+               <p><?php esc_html_e( 'You will receive a link to download your export via email once we are able to fulfill your request.', 'buddypress' ); ?></p>
+
+       <?php endif; ?>
+
+<?php else : ?>
+
+       <p><?php esc_html_e( 'You can request an export of your personal data, containing the following items if applicable:', 'buddypress' ); ?></p>
+
+       <?php bp_settings_data_exporter_items(); ?>
+
+       <p><?php esc_html_e( 'If you want to make a request, please click on the button below:', 'buddypress' ); ?></p>
+
+       <form id="bp-data-export" method="post">
+               <button type="submit" name="bp-data-export-nonce" value="<?php echo wp_create_nonce( 'bp-data-export' ); ?>"><?php esc_html_e( 'Request personal data export', 'buddypress' ); ?></button>
+       </form>
+
+<?php endif; ?>
+
+<h2 class="screen-heading data-settings-screen">
+       <?php esc_html_e( 'Data Erase', 'buddypress' ); ?>
+</h2>
+
+<?php /* translators: Link to Delete Account Settings page */ ?>
+<p><?php esc_html_e( 'To erase all data associated with your account, your user account must be completely deleted.', 'buddypress' ); ?> <?php if ( bp_disable_account_deletion() ) : ?><?php esc_html_e( 'Please contact the site administrator to request account deletion.', 'buddypress' ); ?><?php else : ?><?php printf( esc_html__( 'You may delete your account by visiting the %s page.', 'buddypress' ), sprintf( '<a href="%s">%s</a>', bp_displayed_user_domain() . bp_get_settings_slug() . '/delete-account/', esc_html__( 'Delete Account', 'buddypress' ) ) ); ?><?php endif; ?></p>
+
+<?php
+bp_nouveau_member_hook( 'after', 'settings_template' );
</ins></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaubuddypressmemberssinglesettingsdeleteaccountphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/delete-account.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/delete-account.php   2018-11-02 13:16:25 UTC (rev 12271)
+++ trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/delete-account.php     2018-11-02 14:17:03 UTC (rev 12272)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,7 +3,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * BuddyPress - Members Settings ( Delete Account )
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 3.0.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @version 3.1.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @version 4.0.0
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> bp_nouveau_member_hook( 'before', 'settings_template' ); ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,8 +16,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> <form action="<?php echo esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/delete-account' ); ?>" name="account-delete-form" id="#account-delete-form" class="standard-form" method="post">
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <label class="warn" for="delete-account-understand">
-               <input id="delete-account-understand" class="disabled" type="checkbox" name="delete-account-understand" value="1" data-bp-disable-input="#delete-account-button" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <label id="delete-account-understand" class="warn" for="delete-account-understand">
+               <input class="disabled" type="checkbox" name="delete-account-understand" value="1" data-bp-disable-input="#delete-account-button" />
</ins><span class="cx" style="display: block; padding: 0 10px">                 <?php esc_html_e( 'I understand the consequences.', 'buddypress' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px">        </label>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaubuddypressmemberssinglesettingsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings.php  2018-11-02 13:16:25 UTC (rev 12271)
+++ trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings.php    2018-11-02 14:17:03 UTC (rev 12272)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,7 +2,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * BuddyPress - Users Settings
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @version 3.0.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @version 4.0.0
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -39,6 +39,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">        case 'invites':
</span><span class="cx" style="display: block; padding: 0 10px">                bp_get_template_part( 'members/single/settings/group-invites' );
</span><span class="cx" style="display: block; padding: 0 10px">                break;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        case 'data':
+               bp_get_template_part( 'members/single/settings/data' );
+               break;
</ins><span class="cx" style="display: block; padding: 0 10px">         default:
</span><span class="cx" style="display: block; padding: 0 10px">                bp_get_template_part( 'members/single/plugins' );
</span><span class="cx" style="display: block; padding: 0 10px">                break;
</span></span></pre>
</div>
</div>

</body>
</html>