BP_Activity_Export::process_data( $user,  $page, bool $email_address = false )

Export all the user activity.

Description

Parameters

$user

(Required)

$page

(Required)

$email_address

(Optional)

Default value: false

Return

(array)

Source

File: bp-core/gdpr/class-bp-activity-export.php

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
function process_data( $user, $page, $email_address = false ) {
 
    if ( ! $user || is_wp_error( $user ) ) {
        return $this->response( array(), true );
    }
 
    $export_items = array();
 
    $data_items = $this->get_data( $user, $page );
 
    foreach ( $data_items["items"] as $item ) {
 
        $group_id    = "bp_activities";
        $group_label = __( "Activities & Comments", 'buddyboss' );
        $item_id     = "{$this->exporter_name}-{$group_id}-{$item->id}";
 
        $activity_type = __( 'Profile Update', 'buddyboss' );
 
        if ( 'groups' === $item->component ) {
            $activity_type = __( 'Group Update', 'buddyboss' );
        } elseif ( 'activity_comment' === $item->type ) {
            $activity_type = __( 'Comment', 'buddyboss' );
 
        }
 
        $activity_type = apply_filters( 'buddyboss_bp_gdpr_bp_activity_item_activity_type', $activity_type, $item, $data_items );
 
        $permalink = bp_activity_get_permalink( $item->id );
 
        $data = array(
            array(
                'name'  => __( 'Activity Action', 'buddyboss' ),
                'value' => wp_strip_all_tags( $item->action ),
            ),
            array(
                'name'  => __( 'Activity Content', 'buddyboss' ),
                'value' => $item->content,
            ),
            array(
                'name'  => __( 'Created Date (GMT)', 'buddyboss' ),
                'value' => $item->date_recorded,
            ),
            array(
                'name'  => __( 'Activity Type', 'buddyboss' ),
                'value' => $activity_type,
            ),
            array(
                'name'  => __( 'Activity URL', 'buddyboss' ),
                'value' => $permalink,
            ),
        );
 
        $data = apply_filters( 'buddyboss_bp_gdpr_activity_after_data_prepare', $data, $item, $data_items );
 
        $export_items[] = array(
            'group_id'    => $group_id,
            'group_label' => $group_label,
            'item_id'     => $item_id,
            'data'        => $data,
        );
    }
 
    $done = $data_items["total"] < $data_items["offset"];
 
    return $this->response( $export_items, $done );
}

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.