Skip to:
Content

BuddyPress.org

Changeset 13630


Ignore:
Timestamp:
11/02/2023 06:00:33 PM (16 months ago)
Author:
imath
Message:

BP Options: improve sections naming & listed options/active components

  • The option to let members delete their own account is only available when the BP Settings component is active. If it's not, do not display this option into the Administration screen.
  • Create a new section for the BP Settings component & move the above option into it.
  • Make sure BP Options sections naming is consistent with the names used inside the BP Components Administration tab.

Fixes #9011
Closes https://github.com/buddypress/buddypress/pull/180

Location:
trunk/src/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/admin/bp-core-admin-settings.php

    r13587 r13630  
    2929    <input id="hide-loggedout-adminbar" name="hide-loggedout-adminbar" type="checkbox" value="1" <?php checked( !bp_hide_loggedout_adminbar( false ) ); ?> />
    3030    <label for="hide-loggedout-adminbar"><?php _e( 'Show the Toolbar for logged out users', 'buddypress' ); ?></label>
    31 
    32 <?php
    33 }
    34 
    35 /**
    36  * Allow members to delete their accounts setting field.
    37  *
    38  * @since 1.6.0
    39  *
    40  */
    41 function bp_admin_setting_callback_account_deletion() {
    42 ?>
    43 
    44     <input id="bp-disable-account-deletion" name="bp-disable-account-deletion" type="checkbox" value="1" <?php checked( !bp_disable_account_deletion( false ) ); ?> />
    45     <label for="bp-disable-account-deletion"><?php _e( 'Allow registered members to delete their own accounts', 'buddypress' ); ?></label>
    4631
    4732<?php
     
    361346}
    362347
     348/** Account settings Section ************************************************************/
     349
     350/**
     351 * Account settings section description for the settings page.
     352 *
     353 * @since 12.0.0
     354 */
     355function bp_admin_setting_callback_settings_section() { }
     356
     357/**
     358 * Allow members to delete their accounts setting field.
     359 *
     360 * @since 1.6.0
     361 */
     362function bp_admin_setting_callback_account_deletion() {
     363?>
     364
     365    <input id="bp-disable-account-deletion" name="bp-disable-account-deletion" type="checkbox" value="1" <?php checked( ! bp_disable_account_deletion( false ) ); ?> />
     366    <label for="bp-disable-account-deletion"><?php esc_html_e( 'Allow registered members to delete their own accounts', 'buddypress' ); ?></label>
     367
     368<?php
     369}
     370
    363371/** Settings Page *************************************************************/
    364372
  • trunk/src/bp-core/classes/class-bp-admin.php

    r13628 r13630  
    477477    public function register_admin_settings() {
    478478
    479         /* Main Section ******************************************************/
    480 
    481         // Add the main section.
    482         add_settings_section( 'bp_main', __( 'Main Settings', 'buddypress' ), 'bp_admin_setting_callback_main_section', 'buddypress' );
     479        /* Core Section ******************************************************/
     480
     481        // Add the Core section.
     482        add_settings_section( 'bp_main', __( 'BuddyPress Core', 'buddypress' ), 'bp_admin_setting_callback_main_section', 'buddypress' );
    483483
    484484        // Hide toolbar for logged out users setting.
    485485        add_settings_field( 'hide-loggedout-adminbar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_admin_bar', 'buddypress', 'bp_main' );
    486486        register_setting( 'buddypress', 'hide-loggedout-adminbar', 'intval' );
    487 
    488         // Allow account deletion.
    489         add_settings_field( 'bp-disable-account-deletion', __( 'Account Deletion', 'buddypress' ), 'bp_admin_setting_callback_account_deletion', 'buddypress', 'bp_main' );
    490         register_setting( 'buddypress', 'bp-disable-account-deletion', 'intval' );
    491487
    492488        // Community Visibility
     
    500496        register_setting( 'buddypress', '_bp_theme_package_id', 'sanitize_text_field' );
    501497
     498        /* Account settings Section  *****************************************/
     499
     500        if ( bp_is_active( 'settings' ) ) {
     501            // Add the Settings section.
     502            add_settings_section( 'bp_account_settings', _x( 'Account Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_settings_section', 'buddypress' );
     503
     504            // Allow account deletion.
     505            add_settings_field( 'bp-disable-account-deletion', __( 'Account Deletion', 'buddypress' ), 'bp_admin_setting_callback_account_deletion', 'buddypress', 'bp_account_settings' );
     506            register_setting( 'buddypress', 'bp-disable-account-deletion', 'intval' );
     507        }
     508
    502509        /* Members Section  **************************************************/
    503510
    504511        // Add the main section.
    505         add_settings_section( 'bp_members', _x( 'Members Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_members_section', 'buddypress' );
     512        add_settings_section( 'bp_members', _x( 'Community Members', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_members_section', 'buddypress' );
    506513
    507514        // Avatars.
     
    532539
    533540            // Add the main section.
    534             add_settings_section( 'bp_xprofile', _x( 'Profile Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_xprofile_section', 'buddypress' );
     541            add_settings_section( 'bp_xprofile', _x( 'Extended Profiles', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_xprofile_section', 'buddypress' );
    535542
    536543            // Profile sync setting.
     
    544551
    545552            // Add the main section.
    546             add_settings_section( 'bp_groups', __( 'Groups Settings',  'buddypress' ), 'bp_admin_setting_callback_groups_section', 'buddypress' );
     553            add_settings_section( 'bp_groups', __( 'User Groups',  'buddypress' ), 'bp_admin_setting_callback_groups_section', 'buddypress' );
    547554
    548555            // Allow subscriptions setting.
     
    566573
    567574            // Add the main section.
    568             add_settings_section( 'bp_activity', __( 'Activity Settings', 'buddypress' ), 'bp_admin_setting_callback_activity_section', 'buddypress' );
     575            add_settings_section( 'bp_activity', __( 'Activity Streams', 'buddypress' ), 'bp_admin_setting_callback_activity_section', 'buddypress' );
    569576
    570577            // Activity commenting on post and comments.
Note: See TracChangeset for help on using the changeset viewer.