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

	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.