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

Export member notifications.

Description

Parameters

$user

(Required)

$page

(Required)

$email_address

(bool) (Optional)

Default value: false

Return

(array)

Source

File: bp-core/gdpr/class-bp-notification-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_notifications";
			$group_label = __( "Notifications", 'buddyboss' );
			$item_id     = "{$this->exporter_name}-{$group_id}-{$item->id}";

			$notification = bp_notifications_get_notification( $item->id );

			$action = $this->bp_get_the_notification_description( $notification );
			$action = wp_strip_all_tags( $action );
			$action = apply_filters( 'buddyboss_bp_gdpr_bp_notification_item_action', $action, $item, $data_items );

			$mark_as_read = __( 'No', 'buddyboss' );
			if ( '0' === $item->is_new ) {
				$mark_as_read = __( 'Yes', 'buddyboss' );
			}

			$data = array(
				array(
					'name'  => __( 'Notification Action', 'buddyboss' ),
					'value' => $action,
				),
				array(
					'name'  => __( 'Notified Date (GMT)', 'buddyboss' ),
					'value' => $item->date_notified,
				),
				array(
					'name'  => __( 'Mark as Read', 'buddyboss' ),
					'value' => $mark_as_read,
				),
			);

			$data = apply_filters( 'buddyboss_bp_gdpr_notification_after_data_prepare', $data, $item, $notification, $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.