bp_settings_personal_data_exporter( string $email_address, int $page )
Finds and exports personal data associated with an email address from the Settings component.
Parameters Parameters
- $email_address
-
(string) (Required) The user's email address.
- $page
-
(int) (Required) Batch number.
Return Return
(array) An array of personal data.
Source Source
File: bp-settings/bp-settings-functions.php
function bp_settings_personal_data_exporter( $email_address, $page ) { $email_address = trim( $email_address ); $data_to_export = array(); $user = get_user_by( 'email', $email_address ); if ( ! $user ) { return array( 'data' => array(), 'done' => true, ); } $yes = __( 'Yes', 'buddypress' ); $no = __( 'No', 'buddypress' ); $user_settings = array(); // These settings all default to 'yes' when nothing is saved, so we have to do some pre-processing. $notification_settings = array(); if ( bp_is_active( 'activity' ) ) { $notification_settings[] = array( 'name' => __( 'Receive email when a member mentions you in an update?', 'buddypress' ), 'key' => 'notification_activity_new_mention', ); $notification_settings[] = array( 'name' => __( 'Receive email when a member replies to an update or comment you\'ve posted?', 'buddypress' ), 'key' => 'notification_activity_new_reply', ); } if ( bp_is_active( 'messages' ) ) { $notification_settings[] = array( 'name' => __( 'Receive email when a member sends you a new message?', 'buddypress' ), 'key' => 'notification_messages_new_message', ); } if ( bp_is_active( 'friends' ) ) { $notification_settings[] = array( 'name' => __( 'Receive email when a member invites you to join a group?', 'buddypress' ), 'key' => 'notification_groups_invite', ); } if ( bp_is_active( 'groups' ) ) { $notification_settings[] = array( 'name' => __( 'Receive email when group information is updated?', 'buddypress' ), 'key' => 'notification_groups_group_updated', ); $notification_settings[] = array( 'name' => __( 'Receive email when you are promoted to a group administrator or moderator?', 'buddypress' ), 'key' => 'notification_groups_admin_promoted', ); $notification_settings[] = array( 'name' => __( 'Receive email when a member requests to join a private group for which you are an admin?', 'buddypress' ), 'key' => 'notification_groups_membership_request', ); $notification_settings[] = array( 'name' => __( 'Receive email when your request to join a group has been approved or denied?', 'buddypress' ), 'key' => 'notification_membership_request_completed', ); } foreach ( $notification_settings as $notification_setting ) { $user_notification_setting = bp_get_user_meta( $user->ID, $notification_setting['key'], true ); if ( empty( $user_notification_setting ) ) { $user_notification_setting = 'yes'; } $user_settings[] = array( 'name' => $notification_setting['name'], 'value' => 'yes' === $user_notification_setting ? $yes : $no, ); } if ( function_exists( 'bp_nouveau_groups_get_group_invites_setting' ) ) { $user_settings[] = array( 'name' => __( 'Receive group invitations from my friends only?', 'buddypress' ), 'value' => bp_nouveau_groups_get_group_invites_setting() ? $yes : $no, ); } $data_to_export[] = array( 'group_id' => 'bp_settings', 'group_label' => __( 'Settings', 'buddypress' ), 'item_id' => "bp-settings-{$user->ID}", 'data' => $user_settings, ); return array( 'data' => $data_to_export, 'done' => true, ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
4.0.0 | Introduced. |