/>
/>
theme_compat->packages as $id => $theme ) {
$options .= sprintf(
'',
esc_attr( $id ),
selected( $theme->id, bp_get_theme_package_id(), false ),
esc_html( $theme->name )
);
}
if ( $options ) : ?>
/>
/>
/>
/>
/>
/>
/>
Registration Settings pane:', 'buddypress' ); ?>
WP profile syncing field.
*
* @since 1.6.0
*
*/
function bp_admin_setting_callback_profile_sync() {
?>
/>
/>
/>
/>
$settings ) {
foreach( $settings as $setting_name => $setting ) {
$value = isset( $_POST[$setting_name] ) ? $_POST[$setting_name] : '';
bp_update_option( $setting_name, $value );
}
}
}
// Some legacy options are not registered with the Settings API, or are reversed in the UI.
$legacy_options = array(
'bp-disable-account-deletion',
'bp-disable-avatar-uploads',
'bp-disable-cover-image-uploads',
'bp-disable-group-avatar-uploads',
'bp-disable-group-cover-image-uploads',
'bp_disable_blogforum_comments',
'bp-disable-profile-sync',
'bp_restrict_group_creation',
'hide-loggedout-adminbar',
);
foreach( $legacy_options as $legacy_option ) {
// Note: Each of these options is represented by its opposite in the UI
// Ie, the Profile Syncing option reads "Enable Sync", so when it's checked,
// the corresponding option should be unset.
$value = isset( $_POST[$legacy_option] ) ? '' : 1;
bp_update_option( $legacy_option, $value );
}
bp_core_redirect( add_query_arg( array( 'page' => 'bp-settings', 'updated' => 'true' ), bp_get_admin_url( 'admin.php' ) ) );
}
}
add_action( 'bp_admin_init', 'bp_core_admin_settings_save', 100 );
/**
* Output settings API option.
*
* @since 1.6.0
*
* @param string $option Form option to echo.
* @param string $default Form option default.
* @param bool $slug Form option slug.
*/
function bp_form_option( $option, $default = '' , $slug = false ) {
echo bp_get_form_option( $option, $default, $slug );
}
/**
* Return settings API option
*
* @since 1.6.0
*
*
* @param string $option Form option to return.
* @param string $default Form option default.
* @param bool $slug Form option slug.
* @return string
*/
function bp_get_form_option( $option, $default = '', $slug = false ) {
// Get the option and sanitize it.
$value = bp_get_option( $option, $default );
// Slug?
if ( true === $slug ) {
/**
* Filters the slug value in the form field.
*
* @since 1.6.0
*
* @param string $value Value being returned for the requested option.
*/
$value = esc_attr( apply_filters( 'editable_slug', $value ) );
} else { // Not a slug.
$value = esc_attr( $value );
}
// Fallback to default.
if ( empty( $value ) )
$value = $default;
/**
* Filters the settings API option.
*
* @since 1.6.0
*
* @param string $value Value being returned for the requested option.
* @param string $option Option whose value is being requested.
*/
return apply_filters( 'bp_get_form_option', $value, $option );
}