BP_REST_Settings_Endpoint::get_buddyboss_platform_settings()

Get BuddyBoss Platform Settings.

Description

Return

(array)

Source

File: bp-core/classes/class-bp-rest-settings-endpoint.php

	public function get_buddyboss_platform_settings() {
		$results = array(
			// General settings.
			'bp-enable-site-registration'              => bp_enable_site_registration(),
			'allow-custom-registration'                => bp_allow_custom_registration(),
			'register-confirm-email'                   => bp_register_confirm_email(),
			'register-confirm-password'                => bp_register_confirm_password(),
			'bp-disable-account-deletion'              => bp_disable_account_deletion(),
			'bp-enable-private-network'                => ! bp_enable_private_network(),
			'bp-enable-private-network-public-content' => bp_enable_private_network_public_content(),

			// Profile settings.
			'bp-display-name-format'                   => bp_get_option( 'bp-display-name-format', 'first_name' ),
			'bp-hide-nickname-first-name'              => bp_hide_nickname_first_name(),
			'bp-hide-nickname-last-name'               => bp_hide_nickname_last_name(),
			'bp-disable-avatar-uploads'                => bp_disable_avatar_uploads(),
			'bp-enable-profile-gravatar'               => bp_enable_profile_gravatar(),
			'bp-disable-cover-image-uploads'           => bp_disable_cover_image_uploads(),
			'bp-member-type-enable-disable'            => bp_member_type_enable_disable(),
			'bp-member-type-display-on-profile'        => bp_member_type_display_on_profile(),
			'bp-member-type-default-on-registration'   => bp_member_type_default_on_registration(),
			'bp-enable-profile-search'                 => bp_disable_advanced_profile_search(),
			'bp-profile-layout-format'                 => bp_get_option( 'bp-profile-layout-format', 'list_grid' ),
			'bp-profile-layout-default-format'         => bp_profile_layout_default_format(),

		);

		// Groups settings.
		if ( bp_is_active( 'groups' ) ) {
			// Group Settings.
			$results['bp_restrict_group_creation']           = bp_restrict_group_creation();
			$results['bp-disable-group-avatar-uploads']      = bp_disable_group_avatar_uploads();
			$results['bp-disable-group-cover-image-uploads'] = bp_disable_group_cover_image_uploads();

			// Group Types.
			$results['bp-disable-group-type-creation'] = bp_disable_group_type_creation();
			$results['bp-enable-group-auto-join']      = bp_enable_group_auto_join();

			// Group Hierarchies.
			$results['bp-enable-group-hierarchies']      = bp_enable_group_hierarchies();
			$results['bp-enable-group-restrict-invites'] = bp_enable_group_restrict_invites();

			// Group Directories.
			$results['bp-group-layout-format']         = bp_get_option( 'bp-group-layout-format', 'list_grid' );
			$results['bp-group-layout-default-format'] = bp_group_layout_default_format();
		}

		// Forums settings.
		if ( bp_is_active( 'forums' ) ) {
			// Forum User Settings.
			$results['bbp_edit_lock']       = get_option( '_bbp_edit_lock', '5' );
			$results['bbp_throttle_time']   = get_option( '_bbp_throttle_time', '10' );
			$results['bbp_allow_anonymous'] = bbp_allow_anonymous();

			// Forum Features.
			$results['bbp_allow_revisions']        = bbp_allow_revisions();
			$results['bbp_enable_favorites']       = bbp_is_favorites_active();
			$results['bbp_enable_subscriptions']   = bbp_is_subscriptions_active();
			$results['bbp_allow_topic_tags']       = bbp_allow_topic_tags();
			$results['bbp_allow_search']           = bbp_allow_search();
			$results['bbp_use_wp_editor']          = bbp_use_wp_editor();
			$results['bbp_use_autoembed']          = bbp_use_autoembed();
			$results['bbp_allow_threaded_replies'] = bbp_allow_threaded_replies();
			$results['bbp_thread_replies_depth']   = bbp_thread_replies_depth();

			// Discussions and Replies Per Page.
			$results['bbp_forums_per_page']  = bbp_get_forums_per_page();
			$results['bbp_topics_per_page']  = bbp_get_topics_per_page();
			$results['bbp_replies_per_page'] = bbp_get_replies_per_page();

			// Discussions and Replies Per RSS Page.
			$results['bbp_topics_per_rss_page']  = bbp_get_topics_per_rss_page();
			$results['bbp_replies_per_rss_page'] = bbp_get_replies_per_rss_page();

			// Forums Directory.
			$results['bbp_include_root'] = bbp_include_root_slug();
			$results['bbp_show_on_root'] = bbp_show_on_root();

			// Group Forums.
			$results['bbp_enable_group_forums']  = bbp_is_group_forums_active();
			$results['bbp_group_forums_root_id'] = bbp_get_group_forums_root_id();
		}

		// Activity settings.
		if ( bp_is_active( 'activity' ) ) {
			// Activity Settings.
			$results['bp_enable_heartbeat_refresh']     = bp_is_activity_heartbeat_active();
			$results['bp_enable_activity_autoload']     = bp_is_activity_autoload_active();
			$results['bp_enable_activity_tabs']         = bp_is_activity_tabs_active();
			$results['bp_enable_activity_follow']       = bp_is_activity_follow_active();
			$results['bp_enable_activity_like']         = bp_is_activity_like_active();
			$results['bp_enable_activity_link_preview'] = bp_is_activity_link_preview_active();

			// Posts in Activity Feeds.
			$results['bp-feed-platform-new_avatar']            = bp_platform_is_feed_enable( 'bp-feed-platform-new_avatar' );
			$results['bp-feed-platform-updated_profile']       = bp_platform_is_feed_enable( 'bp-feed-platform-updated_profile' );
			$results['bp-feed-platform-new_member']            = bp_platform_is_feed_enable( 'bp-feed-platform-new_member' );
			$results['bp-feed-platform-friendship_created']    = bp_platform_is_feed_enable( 'bp-feed-platform-friendship_created' );
			$results['bp-feed-platform-created_group']         = bp_platform_is_feed_enable( 'bp-feed-platform-created_group' );
			$results['bp-feed-platform-joined_group']          = bp_platform_is_feed_enable( 'bp-feed-platform-joined_group' );
			$results['bp-feed-platform-group_details_updated'] = bp_platform_is_feed_enable( 'bp-feed-platform-group_details_updated' );
			$results['bp-feed-platform-bbp_topic_create']      = bp_platform_is_feed_enable( 'bp-feed-platform-bbp_topic_create' );
			$results['bp-feed-platform-bbp_reply_create']      = bp_platform_is_feed_enable( 'bp-feed-platform-bbp_reply_create' );
			$results['bp-disable-blogforum-comments']          = bp_disable_blogforum_comments();

			$custom_post_types = bp_get_option( 'bp_core_admin_get_active_custom_post_type_feed', array() );
			if ( ! empty( $custom_post_types ) ) {
				foreach ( $custom_post_types as $single_post ) {
					// check custom post type feed is enabled from the BuddyBoss > Settings > Activity > Custom Post Types metabox settings.
					$enabled = bp_is_post_type_feed_enable( $single_post );
					$results[ 'bp-feed-custom-post-type-' . $single_post ] = $enabled;
				}
			}
		}

		// Media settings.
		if ( bp_is_active( 'media' ) ) {
			// Photo Uploading.
			$results['bp_media_profile_media_support']  = bp_is_profile_media_support_enabled();
			$results['bp_media_profile_albums_support'] = bp_is_profile_albums_support_enabled();
			$results['bp_media_group_media_support']    = bp_is_group_media_support_enabled();
			$results['bp_media_group_albums_support']   = bp_is_group_albums_support_enabled();
			$results['bp_media_messages_media_support'] = bp_is_messages_media_support_enabled();
			$results['bp_media_forums_media_support']   = bp_is_forums_media_support_enabled();

			// Emoji.
			$results['bp_media_profiles_emoji_support'] = bp_is_profiles_emoji_support_enabled();
			$results['bp_media_groups_emoji_support']   = bp_is_groups_emoji_support_enabled();
			$results['bp_media_messages_emoji_support'] = bp_is_messages_emoji_support_enabled();
			$results['bp_media_forums_emoji_support']   = bp_is_forums_emoji_support_enabled();

			// Animated GIFs.
			if ( bp_loggedin_user_id() ) {
				$results['bp_media_gif_api_key'] = bp_media_get_gif_api_key();
			}
			$results['bp_media_profiles_gif_support'] = bp_is_profiles_gif_support_enabled();
			$results['bp_media_groups_gif_support']   = bp_is_groups_gif_support_enabled();
			$results['bp_media_messages_gif_support'] = bp_is_messages_gif_support_enabled();
			$results['bp_media_forums_gif_support']   = bp_is_forums_gif_support_enabled();
		}

		// Connection Settings.
		if ( bp_is_active( 'friends' ) ) {
			$results['bp-force-friendship-to-message'] = bp_force_friendship_to_message();
		}

		// Email Invites Settings.
		if ( bp_is_active( 'invites' ) ) {
			$results['bp-disable-invite-member-email-subject'] = bp_disable_invite_member_email_subject();
			$results['bp-disable-invite-member-email-content'] = bp_disable_invite_member_email_content();
			$results['bp-disable-invite-member-type']          = bp_disable_invite_member_type();

			$member_types = bp_get_active_member_types();
			if ( isset( $member_types ) && ! empty( $member_types ) ) {
				foreach ( $member_types as $member_type_id ) {
					$option_name = bp_get_member_type_key( $member_type_id );
					$results[ 'bp-enable-send-invite-member-type-' . $option_name ] = bp_enable_send_invite_member_type( 'bp-enable-send-invite-member-type-' . $option_name, false );
				}
			}

			$results['bp-email-subject'] = ( true === bp_disable_invite_member_email_subject() ? stripslashes( wp_strip_all_tags( bp_get_member_invitation_subject() ) ) : '' );
			$results['bp-email-content'] = ( true === bp_disable_invite_member_email_content() ? bp_get_member_invites_wildcard_replace( bp_get_member_invitation_message() ) : '' );
		}

		// Network Search.
		if ( bp_is_active( 'search' ) ) {
			$results['bp_search_autocomplete']      = bp_is_search_autocomplete_enable();
			$results['bp_search_number_of_results'] = get_option( 'bp_search_number_of_results', '5' );
		}

		// Additional.
		$results['enable_friendship_connections'] = bp_is_active( 'friends' );
		$results['enable_messages']               = bp_is_active( 'messages' );

		return $results;
	}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.