ups. * See {@see bp_core_get_root_options()}. * * @since 2.3.0 * * @param string $option Name of the option key. * @return mixed Value, if found. */ function bp_core_get_root_option( $option ) { $bp = buddypress(); if ( ! isset( $bp->site_options ) ) { $bp->site_options = bp_core_get_root_options(); } $value = ''; if ( isset( $bp->site_options[ $option ] ) ) { $value = $bp->site_options[ $option ]; } return $value; } /** Active? *******************************************************************/ /** * Is profile syncing disabled? * * @since 1.6.0 * * @param bool $default Optional. Fallback value if not found in the database. * Default: true. * @return bool True if profile sync is enabled, otherwise false. */ function bp_disable_profile_sync( $default = false ) { /** * Filters whether or not profile syncing is disabled. * * @since 1.6.0 * * @param bool $value Whether or not syncing is disabled. */ return (bool) apply_filters( 'bp_disable_profile_sync', (bool) bp_get_option( 'bp-disable-profile-sync', $default ) ); } /** * Is the Toolbar hidden for logged out users? * * @since 1.6.0 * * @param bool $default Optional. Fallback value if not found in the database. * Default: true. * @return bool True if the admin bar should be hidden for logged-out users, * otherwise false. */ function bp_hide_loggedout_adminbar( $default = true ) { /** * Filters whether or not the toolbar is hidden for logged out users. * * @since 1.6.0 * * @param bool $value Whether or not the toolbar is hidden. */ return (bool) apply_filters( 'bp_hide_loggedout_adminbar', (bool) bp_get_option( 'hide-loggedout-adminbar', $default ) ); } /** * Are members able to upload their own avatars? * * @since 1.6.0 * * @param bool $default Optional. Fallback value if not found in the database. * Default: true. * @return bool True if avatar uploads are disabled, otherwise false. */ function bp_disable_avatar_uploads( $default = true ) { /** * Filters whether or not members are able to upload their own avatars. * * @since 1.6.0 * * @param bool $value Whether or not members are able to upload their own avatars. */ return (bool) apply_filters( 'bp_disable_avatar_uploads', (bool) bp_get_option( 'bp-disable-avatar-uploads', $default ) ); } /** * Are members able to upload their own cover images? * * @since 2.4.0 * * @param bool $default Optional. Fallback value if not found in the database. * Default: false. * @return bool True if cover image uploads are disabled, otherwise false. */ function bp_disable_cover_image_uploads( $default = false ) { /** * Filters whether or not members are able to upload their own cover images. * * @since 2.4.0 * * @param bool $value Whether or not members are able to upload their own cover images. */ return (bool) apply_filters( 'bp_disable_cover_image_uploads', (bool) bp_get_option( 'bp-disable-cover-image-uploads', $default ) ); } /** * Are group avatars disabled? * * For backward compatibility, this option falls back on the value of 'bp-disable-avatar-uploads' when no value is * found in the database. * * @since 2.3.0 * * @param bool|null $default Optional. Fallback value if not found in the database. * Defaults to the value of `bp_disable_avatar_uploads()`. * @return bool True if group avatar uploads are disabled, otherwise false. */ function bp_disable_group_avatar_uploads( $default = null ) { $disabled = bp_get_option( 'bp-disable-group-avatar-uploads', '' ); if ( '' === $disabled ) { if ( is_null( $default ) ) { $disabled = bp_disable_avatar_uploads(); } else { $disabled = $default; } } /** * Filters whether or not members are able to upload group avatars. * * @since 2.3.0 * * @param bool $disabled Whether or not members are able to upload their groups avatars. * @param bool $default Default value passed to the function. */ return (bool) apply_filters( 'bp_disable_group_avatar_uploads', $disabled, $default ); } /** * Are group cover images disabled? * * @since 2.4.0 * * @param bool $default Optional. Fallback value if not found in the database. * Default: false. * @return bool True if group cover image uploads are disabled, otherwise false. */ function bp_disable_group_cover_image_uploads( $default = false ) { /** * Filters whether or not members are able to upload group cover images. * * @since 2.4.0 * * @param bool $value Whether or not members are able to upload thier groups cover images. */ return (bool) apply_filters( 'bp_disable_group_cover_image_uploads', (bool) bp_get_option( 'bp-disable-group-cover-image-uploads', $default ) ); } /** * Are members able to delete their own accounts? * * @since 1.6.0 * * @param bool $default Optional. Fallback value if not found in the database. * Default: true. * @return bool True if users are able to delete their own accounts, otherwise * false. */ function bp_disable_account_deletion( $default = false ) { /** * Filters whether or not members are able to delete their own accounts. * * @since 1.6.0 * * @param bool $value Whether or not members are able to delete their own accounts. */ return apply_filters( 'bp_disable_account_deletion', (bool) bp_get_option( 'bp-disable-account-deletion', $default ) ); } /** * Are post/comment activity stream comments disabled? * * @since 1.6.0 * * @todo split and move into blog and forum components. * * @param bool $default Optional. Fallback value if not found in the database. * Default: false. * @return bool True if activity comments are disabled for blog and forum * items, otherwise false. */ function bp_disable_blogforum_comments( $default = false ) { /** * Filters whether or not blog and forum activity stream comments are disabled. * * @since 1.6.0 * * @param bool $value Whether or not blog and forum activity stream comments are disabled. */ return (bool) apply_filters( 'bp_disable_blogforum_comments', (bool) bp_get_option( 'bp-disable-blogforum-comments', $default ) ); } /** * Is group creation turned off? * * @since 1.6.0 * * @todo Move into groups component. * * @param bool $default Optional. Fallback value if not found in the database. * Default: true. * @return bool True if group creation is restricted, otherwise false. */ function bp_restrict_group_creation( $default = true ) { /** * Filters whether or not group creation is turned off. * * @since 1.6.0 * * @param bool $value Whether or not group creation is turned off. */ return (bool) apply_filters( 'bp_restrict_group_creation', (bool) bp_get_option( 'bp_restrict_group_creation', $default ) ); } /** * Check whether Akismet is enabled. * * @since 1.6.0 * * @param bool $default Optional. Fallback value if not found in the database. * Default: true. * @return bool True if Akismet is enabled, otherwise false. */ function bp_is_akismet_active( $default = true ) { /** * Filters whether or not Akismet is enabled. * * @since 1.6.0 * * @param bool $value Whether or not Akismet is enabled. */ return (bool) apply_filters( 'bp_is_akismet_active', (bool) bp_get_option( '_bp_enable_akismet', $default ) ); } /** * Check whether Activity Heartbeat refresh is enabled. * * @since 2.0.0 * * @param bool $default Optional. Fallback value if not found in the database. * Default: true. * @return bool True if Heartbeat refresh is enabled, otherwise false. */ function bp_is_activity_heartbeat_active( $default = true ) { /** * Filters whether or not Activity Heartbeat refresh is enabled. * * @since 2.0.0 * * @param bool $value Whether or not Activity Heartbeat refresh is enabled. */ return (bool) apply_filters( 'bp_is_activity_heartbeat_active', (bool) bp_get_option( '_bp_enable_heartbeat_refresh', $default ) ); } /** * Get the current theme package ID. * * @since 1.7.0 * * @param string $default Optional. Fallback value if not found in the database. * Default: 'legacy'. * @return string ID of the theme package. */ function bp_get_theme_package_id( $default = 'legacy' ) { /** * Filters the current theme package ID. * * @since 1.7.0 * * @param string $value The current theme package ID. */ return apply_filters( 'bp_get_theme_package_id', bp_get_option( '_bp_theme_package_id', $default ) ); }