Changeset 5585 for trunk/bp-core/admin/bp-core-settings.php
- Timestamp:
- 12/23/2011 04:38:17 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-settings.php
r5524 r5585 66 66 ?> 67 67 68 <input id=" _bp_enable_favorites" name="bp-disable-avatar-uploads" type="checkbox" value="1" <?php checked( !bp_disable_avatar_uploads( true ) ); ?> />68 <input id="bp-disable-avatar-uploads" name="bp-disable-avatar-uploads" type="checkbox" value="1" <?php checked( !bp_disable_avatar_uploads( true ) ); ?> /> 69 69 <label for="bp-disable-avatar-uploads"><?php _e( 'Allow members to upload avatars', 'buddypress' ); ?></label> 70 70 … … 82 82 ?> 83 83 84 <input id="bp-disable-account-deletion" name="bp-disable-account-deletion" type="checkbox" value="1" <?php checked( bp_disable_account_deletion( true ) ); ?> />84 <input id="bp-disable-account-deletion" name="bp-disable-account-deletion" type="checkbox" value="1" <?php checked( !bp_disable_account_deletion( true ) ); ?> /> 85 85 <label for="bp-disable-account-deletion"><?php _e( 'Allow members to delete their own accounts', 'buddypress' ); ?></label> 86 86 … … 178 178 */ 179 179 function bp_core_admin_settings() { 180 global $wp_settings_fields; 181 182 // We're saving our own options, until the WP Settings API is updated to work with Multisite 183 $form_action = add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ); 184 185 if ( !empty( $_POST['submit'] ) ) { 186 check_admin_referer( 'buddypress-options' ); 187 188 // Because many settings are saved with checkboxes, and thus will have no values 189 // in the $_POST array when unchecked, we loop through the registered settings 190 if ( isset( $wp_settings_fields['buddypress'] ) ) { 191 foreach( (array)$wp_settings_fields['buddypress'] as $section => $settings ) { 192 foreach( $settings as $setting_name => $setting ) { 193 $value = isset( $_POST[$setting_name] ) ? $_POST[$setting_name] : ''; 194 195 bp_update_option( $setting_name, $value ); 196 } 197 } 198 } 199 200 // Some legacy options are not registered with the Settings API 201 $legacy_options = array( 202 'bp-disable-profile-sync', 203 'hide-loggedout-adminbar', 204 'bp-disable-avatar-uploads', 205 'bp-disable-account-deletion', 206 'bp_restrict_group_creation' 207 ); 208 209 foreach( $legacy_options as $legacy_option ) { 210 // Note: Each of these options is represented by its opposite in the UI 211 // Ie, the Profile Syncing option reads "Enable Sync", so when it's checked, 212 // the corresponding option should be unset 213 $value = isset( $_POST[$legacy_option] ) ? '' : 1; 214 bp_update_option( $legacy_option, $value ); 215 } 216 } 180 217 ?> 181 218 … … 186 223 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Settings', 'buddypress' ) ); ?></h2> 187 224 188 <form action=" options.php" method="post">225 <form action="<?php echo $form_action ?>" method="post"> 189 226 190 227 <?php settings_fields( 'buddypress' ); ?>
Note: See TracChangeset
for help on using the changeset viewer.