Skip to:
Content

BuddyPress.org

Changeset 12553


Ignore:
Timestamp:
02/29/2020 03:28:51 PM (7 years ago)
Author:
imath
Message:

Move Avatars & Cover from xProfile to Members component : step 1

Move Avatar and Cover settings into the Members settings section.

See #8156

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

Legend:

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

    r12056 r12553  
    148148}
    149149
     150/** Members *******************************************************************/
     151
     152/**
     153 * Profile settings section description for the settings page.
     154 *
     155 * @since 1.6.0
     156 */
     157function bp_admin_setting_callback_members_section() { }
     158
     159/**
     160 * Allow members to upload avatars field.
     161 *
     162 * @since 1.6.0
     163 * @since 6.0.0 Setting has been moved into the Members section.
     164 */
     165function bp_admin_setting_callback_avatar_uploads() {
     166?>
     167        <input id="bp-disable-avatar-uploads" name="bp-disable-avatar-uploads" type="checkbox" value="1" <?php checked( !bp_disable_avatar_uploads( false ) ); ?> />
     168        <label for="bp-disable-avatar-uploads"><?php _e( 'Allow registered members to upload avatars', 'buddypress' ); ?></label>
     169<?php
     170}
     171
     172/**
     173 * Allow members to upload cover images field.
     174 *
     175 * @since 2.4.0
     176 * @since 6.0.0 Setting has been moved into the Members section.
     177 */
     178function bp_admin_setting_callback_cover_image_uploads() {
     179?>
     180        <input id="bp-disable-cover-image-uploads" name="bp-disable-cover-image-uploads" type="checkbox" value="1" <?php checked( ! bp_disable_cover_image_uploads() ); ?> />
     181        <label for="bp-disable-cover-image-uploads"><?php _e( 'Allow registered members to upload cover images', 'buddypress' ); ?></label>
     182<?php
     183}
     184
    150185/** XProfile ******************************************************************/
    151186
    … …  
    169204        <label for="bp-disable-profile-sync"><?php _e( 'Enable BuddyPress to WordPress profile syncing', 'buddypress' ); ?></label>
    170205
    171 <?php
    172 }
    173 
    174 /**
    175  * Allow members to upload avatars field.
    176  *
    177  * @since 1.6.0
    178  *
    179  */
    180 function bp_admin_setting_callback_avatar_uploads() {
    181 ?>
    182 
    183         <input id="bp-disable-avatar-uploads" name="bp-disable-avatar-uploads" type="checkbox" value="1" <?php checked( !bp_disable_avatar_uploads( false ) ); ?> />
    184         <label for="bp-disable-avatar-uploads"><?php _e( 'Allow registered members to upload avatars', 'buddypress' ); ?></label>
    185 
    186 <?php
    187 }
    188 
    189 /**
    190  * Allow members to upload cover images field.
    191  *
    192  * @since 2.4.0
    193  */
    194 function bp_admin_setting_callback_cover_image_uploads() {
    195 ?>
    196         <input id="bp-disable-cover-image-uploads" name="bp-disable-cover-image-uploads" type="checkbox" value="1" <?php checked( ! bp_disable_cover_image_uploads() ); ?> />
    197         <label for="bp-disable-cover-image-uploads"><?php _e( 'Allow registered members to upload cover images', 'buddypress' ); ?></label>
    198206<?php
    199207}
  • trunk/src/bp-core/classes/class-bp-admin.php

    r12520 r12553  
    395395                register_setting( 'buddypress', '_bp_theme_package_id', 'sanitize_text_field' );
    396396
     397                /* Members Section  **************************************************/
     398
     399                // Add the main section.
     400                add_settings_section( 'bp_members', _x( 'Members Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_members_section', 'buddypress' );
     401
     402                // Avatars.
     403                add_settings_field( 'bp-disable-avatar-uploads', __( 'Profile Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_members' );
     404                register_setting( 'buddypress', 'bp-disable-avatar-uploads', 'intval' );
     405
     406                // Cover images.
     407                if ( bp_is_active( 'members', 'cover_image' ) ) {
     408                        add_settings_field( 'bp-disable-cover-image-uploads', __( 'Cover Image Uploads', 'buddypress' ), 'bp_admin_setting_callback_cover_image_uploads', 'buddypress', 'bp_members' );
     409                        register_setting( 'buddypress', 'bp-disable-cover-image-uploads', 'intval' );
     410                }
     411
    397412                /* XProfile Section **************************************************/
    398413
    … …  
    401416                        // Add the main section.
    402417                        add_settings_section( 'bp_xprofile', _x( 'Profile Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_xprofile_section', 'buddypress' );
    403 
    404                         // Avatars.
    405                         add_settings_field( 'bp-disable-avatar-uploads', __( 'Profile Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_xprofile' );
    406                         register_setting( 'buddypress', 'bp-disable-avatar-uploads', 'intval' );
    407 
    408                         // Cover images.
    409                         if ( bp_is_active( 'xprofile', 'cover_image' ) ) {
    410                                 add_settings_field( 'bp-disable-cover-image-uploads', __( 'Cover Image Uploads', 'buddypress' ), 'bp_admin_setting_callback_cover_image_uploads', 'buddypress', 'bp_xprofile' );
    411                                 register_setting( 'buddypress', 'bp-disable-cover-image-uploads', 'intval' );
    412                         }
    413418
    414419                        // Profile sync setting.
Note: See TracChangeset for help on using the changeset viewer.