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

1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
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.