Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/20/2022 08:10:19 AM (4 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-nouveau/buddypress/members/single/settings/data.php

    r12908 r13327  
    44 *
    55 * @since 3.1.0
    6  * @version 8.0.0
     6 * @version 11.0.0
    77 */
    88
     
    5959<?php endif; ?>
    6060
    61 <h2 class="screen-heading data-settings-screen">
    62         <?php esc_html_e( 'Data Erase', 'buddypress' ); ?>
    63 </h2>
     61<?php if ( ! user_can( bp_displayed_user_id(), 'delete_users' ) ) : ?>
     62        <h2 class="screen-heading data-settings-screen">
     63                <?php esc_html_e( 'Data Erase', 'buddypress' ); ?>
     64        </h2>
    6465
    65 <?php /* translators: Link to Delete Account Settings page */ ?>
    66 <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_nouveau_get_component_slug( 'settings' ) . '/delete-account/', esc_html__( 'Delete Account', 'buddypress' ) ) ); ?><?php endif; ?></p>
     66        <p>
     67                <?php
     68                esc_html_e( 'To erase all data associated with your account, your user account must be completely deleted.', 'buddypress' );
    6769
     70                if ( bp_disable_account_deletion() ) {
     71                        esc_html_e( 'Please contact the site administrator to request account deletion.', 'buddypress' );
     72                } else {
     73                        echo '&nbsp;';
     74
     75                        printf(
     76                                /* translators: %s the link to Delete Account Settings page */
     77                                esc_html__( 'You may delete your account by visiting the %s page.', 'buddypress' ),
     78                                sprintf(
     79                                        '<a href="%1$s">%2$s</a>',
     80                                        esc_url( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'settings' ) . '/delete-account/' ),
     81                                        esc_html__( 'Delete Account', 'buddypress' )
     82                                )
     83                        );
     84                }
     85                ?>
     86        </p>
    6887<?php
     88endif;
     89
    6990bp_nouveau_member_hook( 'after', 'settings_template' );
Note: See TracChangeset for help on using the changeset viewer.