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

Export member profile settings.

Description

Parameters

$user

(Required)

$page

(Required)

$email_address

(Optional)

Default value: false

Return

(array)

Source

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

47
48
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
function process_data( $user, $page, $email_address = false ) {
 
    if ( ! $user || is_wp_error( $user ) ) {
        return $this->response( array(), true );
    }
 
    $export_items = array();
    $group_id     = 'bp_settings';
    $group_label  = __( 'Settings', 'buddyboss' );
    $item_id      = "{$this->exporter_name}-{$group_id}";
 
    /**
     * Email Preferences
     */
 
    $notification_settings = $this->get_notification_settings();
 
    $notification_data = array();
 
    foreach ( $notification_settings as $noti_key => $notification_label ) {
 
        $value = bp_get_user_meta( $user->ID, $noti_key, true );
 
        if ( empty( $value ) || 'yes' === $value ) {
            if ( 'yes' === $value ) {
                $value = __( 'Yes', 'buddyboss' );
            } else {
                $value = __( 'Yes (Default)', 'buddyboss' );
            }
        } else {
            $value = __( 'No', 'buddyboss' );
        }
 
        $notification_data[] = array(
            'name'  => $notification_label,
            'value' => $value,
        );
 
    }
 
    $notification_data = apply_filters( 'buddyboss_bp_gdpr_notification_settings_after_data_prepare', $notification_data, $user );
 
    $export_items[] = array(
        'group_id'    => $group_id . '_notification',
        'group_label' => __( 'Email Preferences', 'buddyboss' ),
        'item_id'     => 'bp_notification_settings',
        'data'        => $notification_data,
    );
 
    $export_items = apply_filters( 'buddyboss_bp_gdpr_additional_settings', $export_items, $user );
 
    $done = true;
 
    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.