BP_LearnDash_Admin_Integration_Tab::registerLearnDashSettings()

Register LearnDash related settings

Description

Source

File: bp-integrations/learndash/bp-admin-learndash-tab.php

	public function registerLearnDashSettings() {
		$this->current_section = 'learndash';

		$this->add_section(
			'bp_ld_sync-learndash',
			__('LearnDash groups <span>&rarr; Social groups</span>', 'buddyboss')
		);

		$this->add_checkbox_field(
			'enabled',
			__('LearnDash Group Sync', 'buddyboss'),
			[
				'input_text' => sprintf(
					__('Enable group sync functionality <b>FROM</b> <a href="%s">LearnDash Groups</a> <b>TO</b> <a href="%s">BuddyBoss Social Groups</a>', 'buddyboss'),
					add_query_arg([
						'post_type' => 'groups',
					], admin_url('edit.php')),
					add_query_arg([
						'page' => 'bp-groups',
					], admin_url('admin.php'))
				),
				'input_run_js' => 'learndash_enabled',
			]
		);

		$this->add_checkbox_field(
			'default_auto_sync',
			__('Auto Create Social Group', 'buddyboss'),
			[
				'input_text' => __('Automatically create and associate a Social Group upon creation', 'buddyboss'),
				'class' => 'js-show-on-learndash_enabled',
			]
		);

		$this->add_select_field(
			'default_bp_privacy',
			__('Social Group Privacy', 'buddyboss'),
			[
				'input_options' => [
					'public' => __('Public', 'buddyboss'),
					'private' => __('Private', 'buddyboss'),
					'hidden' => __('Hidden', 'buddyboss'),
				],
				'input_default' => 'private',
				'input_description' => __('Select the default social group Privacy setting upon creation', 'buddyboss'),
				'class' => 'js-show-on-learndash_enabled',
			]
		);

		$this->add_select_field(
			'default_bp_invite_status',
			__('Social Group Invite Status', 'buddyboss'),
			[
				'input_options' => [
					'members' => __('All group members', 'buddyboss'),
					'mods' => __('Group organizers and moderators only', 'buddyboss'),
					'admins' => __('Group organizers only', 'buddyboss'),
				],
				'input_default' => 'mods',
				'input_description' => __('Select which group members can invite others to join the group', 'buddyboss'),
				'class' => 'js-show-on-learndash_enabled',
			]
		);

		$this->add_checkbox_field(
			'delete_bp_on_delete',
			__('Auto Delete Social Group', 'buddyboss'),
			[
				'input_text' => __('Automatically delete the associated Social Group when the LearnDash group is deleted', 'buddyboss'),
				'class' => 'js-show-on-learndash_enabled',
			]
		);

		$this->add_select_field(
			'default_admin_sync_to',
			__('Sync Leaders', 'buddyboss'),
			[
				'input_options' => [
					'admin' => __('Organizer', 'buddyboss'),
					'mod' => __('Moderator', 'buddyboss'),
					'user' => __('Member', 'buddyboss'),
					'none' => __('None', 'buddyboss'),
				],
				'input_default' => 'admin',
				'input_description' => __('LearnDash "Group Leaders" will be assigned to the above role in social groups', 'buddyboss'),
				'class' => 'js-show-on-learndash_enabled',
			]
		);

		$this->add_select_field(
			'default_user_sync_to',
			__('Sync Users', 'buddyboss'),
			[
				'input_options' => [
					'admin' => __('Organizer', 'buddyboss'),
					'mod' => __('Moderator', 'buddyboss'),
					'user' => __('Member', 'buddyboss'),
					'none' => __('None', 'buddyboss'),
				],
				'input_default' => 'user',
				'input_description' => __('LearnDash "Group Users" will be assigned to the above role in social groups', 'buddyboss'),
				'class' => 'js-show-on-learndash_enabled',
			]
		);

		// Register View Tutorial button.
		$this->add_field( 'bp-privacy-tutorial-ld-to-bb-sync','', [$this, 'bp_privacy_tutorial_ld_to_bb_sync' ] );
	}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

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.