bp_dd_import_forums( bool|array $users = false )

Importer engine – FORMS

Description

Parameters

$users

(Optional) Users list we want to work with. Get random if empty.

Default value: false

Return

(array)

Source

File: bp-core/bp-core-tools-default-data.php

function bp_dd_import_forums( $users = false ) {
	$forums    = array();
	$forum_ids = bp_get_option( 'bp_dd_imported_forum_ids', array() );

	if ( ! bp_is_active( 'forums' ) ) {
		return $forum_ids;
	}

	// Use currently available users from DB if no default were specified.
	if ( empty( $users ) ) {
		$users = bp_dd_get_random_users_ids( 0 );
	}

	require( BP_DEFAULT_DATA_DIR . 'data/forums.php' );

	foreach ( $forums as $forum ) {

		$forum_id = bp_dd_create_forums( $forum, $users );

		if ( ! empty( $forum_id ) ) {
			$forum_ids[] = $forum_id;
		}
	}

	if ( ! empty( $forum_ids ) ) {
		/** @noinspection PhpParamsInspection */
		bp_update_option( 'bp_dd_imported_forum_ids', array_unique( $forum_ids ) );
	}

	return $forum_ids;
}

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.