BP_Bbp_Gdpr_Forums::forums_exporter( $email_address, int $page = 1 )
Export member created forum data.
Description
Parameters
- $email_address
-
(Required)
- $page
-
(Optional)
Default value: 1
Return
(array)
Source
File: bp-core/gdpr/class-bp-bbp-gdpr-forums.php
function forums_exporter( $email_address, $page = 1 ) {
$per_page = 500; // Limit to avoid timeout
$page = (int) $page;
$export_items = array();
$user = get_user_by( 'email', $email_address );
if ( false === $user ) {
return array(
'data' => $export_items,
'done' => true,
);
}
$forums_details = $this->get_forums( $user, $page, $per_page );
$total = isset( $forums_details['total'] ) ? $forums_details['total'] : 0;
$forums = isset( $forums_details['forums'] ) ? $forums_details['forums'] : array();
if ( $total > 0 ) {
foreach ( $forums as $forum ) {
$item_id = "bbp-forum-{$forum->ID}";
$group_id = 'bbp-forums';
$group_label = __( 'Forums', 'buddyboss' );
$permalink = get_permalink( $forum->ID );
// Plugins can add as many items in the item data array as they want
$data = array(
array(
'name' => __( 'Forum Author', 'buddyboss' ),
'value' => $user->display_name,
),
array(
'name' => __( 'Forum Author Email', 'buddyboss' ),
'value' => $user->user_email,
),
array(
'name' => __( 'Forum Title', 'buddyboss' ),
'value' => $forum->post_title,
),
array(
'name' => __( 'Forum Content', 'buddyboss' ),
'value' => $forum->post_content,
),
array(
'name' => __( 'Forum Date', 'buddyboss' ),
'value' => $forum->post_date,
),
array(
'name' => __( 'Forum URL', 'buddyboss' ),
'value' => $permalink,
),
);
$export_items[] = array(
'group_id' => $group_id,
'group_label' => $group_label,
'item_id' => $item_id,
'data' => $data,
);
}
}
$offset = ( $page - 1 ) * $per_page;
// Tell core if we have more comments to work on still
$done = $total < $offset;
return array(
'data' => $export_items,
'done' => $done,
);
}
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.