Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/20/2022 08:10:19 AM (3 years ago)
Author:
imath
Message:

Settings: put the Legacy template pack’s in line with Nouveau’s one

Makes sure, just like the BP Nouveau template pack, the BP Legacy’s members/single/settings/data.php template contains a section to inform how the user can completely remove their data. This commit also brings some complementary improvements:

  • Avoid is_super_admin( $user_id ) usage in favor of a capability check.
  • Remove some commented code which was duplicated from a previous section into the legacy settings/data template.
  • Escape URLs and translated strings.
  • Improve `/* Translators: */ inline comment.
  • Do not show the link to delete an account to an administrator viewing their account as they are redirected to the member's home page when trying to reach the delete-account screen (Admins cannot delete their account form front end).

Props Venutius, tahmidulkarim

Closes https://github.com/buddypress/buddypress/pull/23
Fixes #8021

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/data.php

    r12595 r13327  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 4.0.0
     7 * @version 11.0.0
    88 */
    99
     
    1111do_action( 'bp_before_member_settings_template' ); ?>
    1212
    13 <h2><?php _e( 'Data Export', 'buddypress' );?></h2>
     13<h2><?php esc_html_e( 'Data Export', 'buddypress' );?></h2>
    1414
    1515<?php $request = bp_settings_get_personal_data_request(); ?>
     
    6969<?php endif; ?>
    7070
    71 <!--
    72 <h2 class="bp-screen-reader-text"><?php
    73     /* translators: accessibility text */
    74     _e( 'Data Erase', 'buddypress' );
    75 ?></h2>
     71<?php if ( ! user_can( bp_displayed_user_id(), 'delete_users' ) ) : ?>
     72    <h2><?php esc_html_e( 'Data Erase', 'buddypress' ); ?></h2>
     73    <p>
     74        <?php
     75        esc_html_e( 'To erase all data associated with your account, your user account must be completely deleted.', 'buddypress' );
    7676
    77 <p>You can make a request to erase the following type of data from the site:</p>
     77        if ( bp_disable_account_deletion() ) {
     78            esc_html_e( 'Please contact the site administrator to request account deletion.', 'buddypress' );
     79        } else {
     80            echo '&nbsp;';
    7881
    79 <p>If you want to make a request, please click on the button below:</p>
    80 
    81     <form id="bp-data-erase" method="post">
    82         <button type="submit" name="bp-data-erase-nonce" value="<?php echo wp_create_nonce( 'bp-data-erase' ); ?>">Request data erasure</button>
    83     </form>
    84 -->
    85 
     82            printf(
     83                /* translators: %s the link to Delete Account Settings page */
     84                esc_html__( 'You may delete your account by visiting the %s page.', 'buddypress' ),
     85                sprintf(
     86                    '<a href="%1$s">%2$s</a>',
     87                    esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/delete-account/' ),
     88                    esc_html__( 'Delete Account', 'buddypress' )
     89                )
     90            );
     91        }
     92        ?>
     93    </p>
    8694<?php
     95endif;
    8796
    8897/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/settings/profile.php */
Note: See TracChangeset for help on using the changeset viewer.