diff --git bp-core/admin/bp-core-settings.php bp-core/admin/bp-core-settings.php
index 6909a19..6982f38 100644
|
|
|
function bp_admin_setting_callback_activity_akismet() { |
| 82 | 82 | function bp_admin_setting_callback_blogforum_comments() { |
| 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( false === (bool) bp_get_option( 'bp-disable-blogforum-comments' ) ); ?> /> |
| 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 | 89 | } |
| 90 | 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; |
| | 102 | } |
| | 103 | |
| 91 | 104 | /** XProfile ******************************************************************/ |
| 92 | 105 | |
| 93 | 106 | /** |
| … |
… |
function bp_admin_setting_callback_bbpress_configuration() { |
| 203 | 216 | * @uses do_settings_sections() To output the settings sections |
| 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 | |
| 211 | 257 | // Because many settings are saved with checkboxes, and thus will have no values |
| … |
… |
function bp_core_admin_settings() { |
| 237 | 283 | $value = isset( $_POST[$legacy_option] ) ? '' : 1; |
| 238 | 284 | bp_update_option( $legacy_option, $value ); |
| 239 | 285 | } |
| 240 | | } |
| 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 | 286 | |
| 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 |
| | 287 | bp_core_redirect( add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ); |
| | 288 | } |
| 264 | 289 | } |
| | 290 | add_action( 'bp_admin_init', 'bp_core_admin_settings_save', 100 ); |
| 265 | 291 | |
| 266 | 292 | /** |
| 267 | 293 | * Output settings API option |
diff --git bp-core/bp-core-admin.php bp-core/bp-core-admin.php
index eb36ba4..d0d2f0a 100644
|
|
|
class BP_Admin { |
| 339 | 339 | |
| 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 |
| 345 | 345 | if ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) { |