Changeset 6156
- Timestamp:
- 06/30/2012 01:26:18 PM (12 years ago)
- Location:
- trunk/bp-core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-settings.php
r6145 r6156 83 83 ?> 84 84 85 <input id="bp-disable-blogforum-comments" name="bp-disable-blogforum-comments" type="checkbox" value="1" <?php checked( bp_disable_blogforum_comments( true ) ); ?> />85 <input id="bp-disable-blogforum-comments" name="bp-disable-blogforum-comments" type="checkbox" value="1" <?php checked( !bp_disable_blogforum_comments( false ) ); ?> /> 86 86 <label for="bp-disable-blogforum-comments"><?php _e( 'Allow activity stream commenting on blog and forum posts', 'buddypress' ); ?></label> 87 87 88 88 <?php 89 } 90 91 /** 92 * Sanitization for bp-disable-blogforum-comments setting 93 * 94 * In the UI, a checkbox asks whether you'd like to *enable* blog/forum activity comments. For 95 * legacy reasons, the option that we store is 1 if these comments are *disabled*. So we use this 96 * function to flip the boolean before saving the intval. 97 * 98 * @since BuddyPress (1.6) 99 */ 100 function bp_admin_sanitize_callback_blogforum_comments( $value = false ) { 101 return $value ? 0 : 1; 89 102 } 90 103 … … 204 217 */ 205 218 function bp_core_admin_settings() { 219 220 // We're saving our own options, until the WP Settings API is updated to work with Multisite 221 $form_action = add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ); 222 223 ?> 224 225 <div class="wrap"> 226 227 <?php screen_icon( 'buddypress' ); ?> 228 229 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Settings', 'buddypress' ) ); ?></h2> 230 231 <form action="<?php echo $form_action ?>" method="post"> 232 233 <?php settings_fields( 'buddypress' ); ?> 234 235 <?php do_settings_sections( 'buddypress' ); ?> 236 237 <p class="submit"> 238 <input type="submit" name="submit" class="button-primary" value="<?php _e( 'Save Changes', 'buddypress' ); ?>" /> 239 </p> 240 </form> 241 </div> 242 243 <?php 244 } 245 246 /** 247 * Save our settings 248 * 249 * @since BuddyPress (1.6) 250 */ 251 function bp_core_admin_settings_save() { 206 252 global $wp_settings_fields; 207 253 208 if ( !empty( $_POST['submit'] ) ) {254 if ( isset( $_GET['page'] ) && 'bp-settings' == $_GET['page'] && !empty( $_POST['submit'] ) ) { 209 255 check_admin_referer( 'buddypress-options' ); 210 256 … … 238 284 bp_update_option( $legacy_option, $value ); 239 285 } 286 287 bp_core_redirect( add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ); 240 288 } 241 242 // We're saving our own options, until the WP Settings API is updated to work with Multisite 243 $form_action = add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ); ?> 244 245 <div class="wrap"> 246 247 <?php screen_icon( 'buddypress' ); ?> 248 249 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Settings', 'buddypress' ) ); ?></h2> 250 251 <form action="<?php echo $form_action ?>" method="post"> 252 253 <?php settings_fields( 'buddypress' ); ?> 254 255 <?php do_settings_sections( 'buddypress' ); ?> 256 257 <p class="submit"> 258 <input type="submit" name="submit" class="button-primary" value="<?php _e( 'Save Changes', 'buddypress' ); ?>" /> 259 </p> 260 </form> 261 </div> 262 263 <?php 264 } 289 } 290 add_action( 'bp_admin_init', 'bp_core_admin_settings_save', 100 ); 265 291 266 292 /** -
trunk/bp-core/bp-core-admin.php
r6079 r6156 340 340 // Activity commenting on blog and forum posts 341 341 add_settings_field( 'bp-disable-blogforum-comments', __( 'Blog & Forum Comments', 'buddypress' ), 'bp_admin_setting_callback_blogforum_comments', 'buddypress', 'bp_activity' ); 342 register_setting( 'buddypress', 'bp-disable-blogforum-comments', ' intval' );342 register_setting( 'buddypress', 'bp-disable-blogforum-comments', 'bp_admin_sanitize_callback_blogforum_comments' ); 343 343 344 344 // Allow activity akismet
Note: See TracChangeset
for help on using the changeset viewer.