Changeset 12159
- Timestamp:
- 06/04/2018 08:01:09 PM (7 years ago)
- Location:
- trunk/src/bp-settings
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-settings/bp-settings-functions.php
r11241 r12159 109 109 return $key_whitelist; 110 110 } 111 112 /** 113 * Finds and exports personal data associated with an email address from the Settings component. 114 * 115 * @since 4.0.0 116 * 117 * @param string $email_address The user's email address. 118 * @param int $page Batch number. 119 * @return array An array of personal data. 120 */ 121 function bp_settings_personal_data_exporter( $email_address, $page ) { 122 $email_address = trim( $email_address ); 123 124 $data_to_export = array(); 125 126 $user = get_user_by( 'email', $email_address ); 127 128 if ( ! $user ) { 129 return array( 130 'data' => array(), 131 'done' => true, 132 ); 133 } 134 135 $yes = __( 'Yes', 'buddypress' ); 136 $no = __( 'No', 'buddypress' ); 137 138 $user_settings = array(); 139 140 // These settings all default to 'yes' when nothing is saved, so we have to do some pre-processing. 141 $notification_settings = array(); 142 143 if ( bp_is_active( 'activity' ) ) { 144 $notification_settings[] = array( 145 'name' => __( 'Receive email when a member mentions you in an update?', 'buddypress' ), 146 'key' => 'notification_activity_new_mention', 147 ); 148 $notification_settings[] = array( 149 'name' => __( 'Receive email when a member replies to an update or comment you\'ve posted?', 'buddypress' ), 150 'key' => 'notification_activity_new_reply', 151 ); 152 } 153 154 if ( bp_is_active( 'messages' ) ) { 155 $notification_settings[] = array( 156 'name' => __( 'Receive email when a member sends you a new message?', 'buddypress' ), 157 'key' => 'notification_messages_new_message', 158 ); 159 } 160 161 if ( bp_is_active( 'friends' ) ) { 162 $notification_settings[] = array( 163 'name' => __( 'Receive email when a member invites you to join a group?', 'buddypress' ), 164 'key' => 'notification_groups_invite', 165 ); 166 } 167 168 if ( bp_is_active( 'groups' ) ) { 169 $notification_settings[] = array( 170 'name' => __( 'Receive email when group information is updated?', 'buddypress' ), 171 'key' => 'notification_groups_group_updated', 172 ); 173 $notification_settings[] = array( 174 'name' => __( 'Receive email when you are promoted to a group administrator or moderator?', 'buddypress' ), 175 'key' => 'notification_groups_admin_promoted', 176 ); 177 $notification_settings[] = array( 178 'name' => __( 'Receive email when a member requests to join a private group for which you are an admin?', 'buddypress' ), 179 'key' => 'notification_groups_membership_request', 180 ); 181 $notification_settings[] = array( 182 'name' => __( 'Receive email when your request to join a group has been approved or denied?', 'buddypress' ), 183 'key' => 'notification_membership_request_completed', 184 ); 185 } 186 187 foreach ( $notification_settings as $notification_setting ) { 188 $user_notification_setting = bp_get_user_meta( $user->ID, $notification_setting['key'], true ); 189 if ( empty( $user_notification_setting ) ) { 190 $user_notification_setting = 'yes'; 191 } 192 193 $user_settings[] = array( 194 'name' => $notification_setting['name'], 195 'value' => 'yes' === $user_notification_setting ? $yes : $no, 196 ); 197 } 198 199 if ( function_exists( 'bp_nouveau_groups_get_group_invites_setting' ) ) { 200 $user_settings[] = array( 201 'name' => __( 'Receive group invitations from my friends only?', 'buddypress' ), 202 'value' => bp_nouveau_groups_get_group_invites_setting() ? $yes : $no, 203 ); 204 } 205 206 $data_to_export[] = array( 207 'group_id' => 'bp_settings', 208 'group_label' => __( 'Settings', 'buddypress' ), 209 'item_id' => "bp-settings-{$user->ID}", 210 'data' => $user_settings, 211 ); 212 213 return array( 214 'data' => $data_to_export, 215 'done' => true, 216 ); 217 } -
trunk/src/bp-settings/classes/class-bp-settings-component.php
r12088 r12159 44 44 parent::includes( array( 45 45 'template', 46 'filters', 46 47 'functions', 47 48 ) );
Note: See TracChangeset
for help on using the changeset viewer.