bp_dd_import_forums_topics_replies( $topics = false )
Import replies in to forums.
Description
Parameters
- $forums
-
(bool) (Required) We can import random groups or work with a predefined list.
Return
(array)
Source
File: bp-core/bp-core-tools-default-data.php
function bp_dd_import_forums_topics_replies( $topics = false ) { $replies = array(); $reply_ids = bp_get_option( 'bp_dd_imported_reply_ids', array() ); if ( ! bp_is_active( 'forums' ) ) { return $reply_ids; } if ( ! $topics ) { $topics = bp_dd_get_random_topics_ids( 0 ); } $users = bp_dd_get_random_users_ids( 0 ); require( BP_DEFAULT_DATA_DIR . 'data/forums_replies.php' ); foreach ( $topics as $topic_id ) { $reply = (array) array_rand( $replies, absint( rand( 1, 7 ) ) ); foreach ( $reply as $reply_key ) { $reply_data = $replies[ $reply_key ]; $reply_id = bp_dd_create_forums_topics_replies( $reply_data, $topic_id, $users ); if ( ! empty( $reply_id ) ) { $reply_ids[] = $reply_id; } } } if ( ! empty( $reply_ids ) ) { /** @noinspection PhpParamsInspection */ bp_update_option( 'bp_dd_imported_reply_ids', array_unique( $reply_ids ) ); } return $reply_ids; }
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.