Ticket #8582: 8582.7.patch
File 8582.7.patch, 35.1 KB (added by , 3 years ago) |
---|
-
src/bp-core/admin/js/bp-thickbox.js
diff --git src/bp-core/admin/js/bp-thickbox.js src/bp-core/admin/js/bp-thickbox.js index e69de29bb..0bafd38fa 100644
1 /** 2 * Improves the Thickbox library for BuddyPress needs. 3 * 4 * @since 10.0.0 5 */ 6 ( function( $ ) { 7 window.bpAdjustThickbox = function( label, padding ) { 8 $( '#TB_window' ).attr( { 9 'role': 'dialog', 10 'aria-label': label 11 } ) 12 .addClass( 'plugin-details-modal' ) 13 .removeClass( 'thickbox-loading' ); 14 15 16 if ( ! padding ) { 17 padding = 0; 18 } 19 20 $( '#TB_ajaxContent' ).prop( 'style', 'height: 100%; width: auto; padding: ' + padding + '; border: none;' ); 21 22 try { 23 var tabbables = $( ':tabbable', '#TB_ajaxContent' ), lastTabbable = tabbables.last(); 24 25 // Move the focus to the Modal's close button once the last Hello link was tabbed out. 26 $( '#TB_window' ).on( 'keydown', function( event ) { 27 var keyCode; 28 29 if ( event.key !== undefined ) { 30 keyCode = event.key; 31 } else { 32 // event.keyCode is deprecated. 33 keyCode = event.keyCode; 34 } 35 36 if ( 9 === keyCode && ! event.shiftKey && $( lastTabbable ).prop( 'classList' ).value === $( event.target ).prop( 'classList' ).value ) { 37 event.preventDefault(); 38 39 $( '#TB_closeWindowButton' ).trigger( 'focus' ); 40 } 41 42 if ( 9 === keyCode && event.shiftKey && 'TB_closeWindowButton' === $( event.target ).prop( 'id' ) ) { 43 event.preventDefault(); 44 45 $( lastTabbable ).trigger( 'focus' ); 46 } 47 } ); 48 } catch ( error ) { 49 return; 50 } 51 }; 52 } ( jQuery ) ); -
src/bp-core/admin/js/hello.js
diff --git src/bp-core/admin/js/hello.js src/bp-core/admin/js/hello.js index 47c996579..77461a559 100644
19 19 } 20 20 21 21 window.tb_show( 'BuddyPress', '#TB_inline?inlineId=bp-hello-container' ); 22 23 $( '#TB_window' ).attr( { 24 'role': 'dialog', 25 'aria-label': bpHelloStrings.modalLabel 26 } ) 27 .addClass( 'plugin-details-modal' ) 28 .removeClass( 'thickbox-loading' ); 29 30 $( '#TB_ajaxContent' ).prop( 'style', 'height: 100%; width: auto; padding: 0; border: none;' ); 31 32 var tabbables = $( ':tabbable', '#TB_ajaxContent' ), lastTabbable = tabbables.last(); 33 34 // Move the focus to the Modal's close button once the last Hello link was tabbed out. 35 $( '#TB_window' ).on( 'keydown', function( event ) { 36 if ( 9 === event.keyCode && ! event.shiftKey && $( lastTabbable ).prop( 'classList' ).value === $( event.target ).prop( 'classList' ).value ) { 37 event.preventDefault(); 38 39 $( '#TB_closeWindowButton' ).focus(); 40 } 41 42 if ( 9 === event.keyCode && event.shiftKey && 'TB_closeWindowButton' === $( event.target ).prop( 'id' ) ) { 43 event.preventDefault(); 44 45 $( lastTabbable ).focus(); 46 } 47 } ); 22 window.bpAdjustThickbox( bpHelloStrings.modalLabel ); 48 23 }; 49 24 50 25 /** -
src/bp-core/classes/class-bp-admin.php
diff --git src/bp-core/classes/class-bp-admin.php src/bp-core/classes/class-bp-admin.php index 24d3678ee..0fe584430 100644
class BP_Admin { 1288 1288 'footer' => true, 1289 1289 ), 1290 1290 1291 // 10.0 1292 'bp-thickbox' => array( 1293 'file' => "{$url}bp-thickbox{$min}.js", 1294 'dependencies' => array( 'thickbox' ), 1295 'footer' => true, 1296 ), 1297 1291 1298 // 3.0 1292 1299 'bp-hello-js' => array( 1293 1300 'file' => "{$url}hello{$min}.js", 1294 'dependencies' => array( ' thickbox', 'wp-api-request' ),1301 'dependencies' => array( 'bp-thickbox', 'wp-api-request' ), 1295 1302 'footer' => true, 1296 1303 ), 1297 1304 ) ); -
src/bp-members/admin/js/signup-preview.js
diff --git src/bp-members/admin/js/signup-preview.js src/bp-members/admin/js/signup-preview.js index e69de29bb..15c200ea7 100644
1 /* global bpSignupPreview */ 2 /** 3 * Opens a modal to preview a signup/membership request. 4 * 5 * @since 10.0.0 6 */ 7 ( function( $ ) { 8 // Bail if not set or if Thickbox is not available. 9 if ( typeof bpSignupPreview === 'undefined' || 'function' !== typeof window.tb_show ) { 10 return; 11 } 12 13 $( function() { 14 $( '.bp-thickbox' ).on( 'click', function( e ) { 15 e.preventDefault(); 16 17 var fragment = $( e.target ).prop( 'href' ).split( '#TB_inline&' )[1]; 18 19 window.tb_show( 'BuddyPress', '#TB_inline?' + fragment ); 20 window.bpAdjustThickbox( bpSignupPreview.modalLabel, '1em' ); 21 } ); 22 } ); 23 }( jQuery ) ); -
src/bp-members/bp-members-admin.php
diff --git src/bp-members/bp-members-admin.php src/bp-members/bp-members-admin.php index 1b80fe190..3aa4e01d7 100644
function bp_members_type_admin_updated_messages( $messages = array() ) { 112 112 return $messages; 113 113 } 114 114 add_filter( 'term_updated_messages', 'bp_members_type_admin_updated_messages' ); 115 116 /** 117 * Formats xprofile field data about a signup/membership request for display. 118 * 119 * Operates recursively on arrays, which are then imploded with commas. 120 * 121 * @since 10.0.0 122 * 123 * @param string|array $value Field value. 124 */ 125 function bp_members_admin_format_xprofile_field_for_display( $value ) { 126 if ( is_array( $value ) ) { 127 $value = array_map( 'bp_signup_format_xprofile_field_for_display', $value ); 128 $value = implode( ', ', $value ); 129 } else { 130 $value = stripslashes( $value ); 131 $value = esc_html( $value ); 132 } 133 134 return $value; 135 } 136 137 /** 138 * Outputs Informations about a signup/membership request into a modal inside the Signups Admin Screen. 139 * 140 * @since 10.0.0 141 * 142 * @param array $signup_field_labels The Signup field labels. 143 * @param object|null $signup_object The signup data object. 144 */ 145 function bp_members_admin_preview_signup_profile_info( $signup_field_labels = array(), $signup_object = null ) { 146 if ( ! isset( $signup_object->meta ) || ! $signup_field_labels ) { 147 return; 148 } 149 150 // Init ids. 151 $profile_field_ids = array(); 152 153 // Get all xprofile field IDs except field 1. 154 if ( ! empty( $signup_object->meta['profile_field_ids'] ) ) { 155 $profile_field_ids = array_flip( explode( ',', $signup_object->meta['profile_field_ids'] ) ); 156 unset( $profile_field_ids[1] ); 157 } 158 ?> 159 <div id="signup-info-modal-<?php echo $signup_object->id; ?>" style="display:none;"> 160 <h1><?php printf( '%1$s (%2$s)', esc_html( $signup_object->user_name ), esc_html( $signup_object->user_email ) ); ?></h1> 161 <h2><?php esc_html_e( 'Extended Profile Information', 'buddypress' ); ?></h2> 162 163 <table class="signup-profile-data-drawer wp-list-table widefat fixed striped"> 164 <?php if ( 1 <= count( $profile_field_ids ) ): foreach ( array_keys( $profile_field_ids ) as $profile_field_id ) : 165 $field_value = isset( $signup_object->meta[ "field_{$profile_field_id}" ] ) ? $signup_object->meta[ "field_{$profile_field_id}" ] : ''; ?> 166 <tr> 167 <td class="column-fields"><?php echo esc_html( $signup_field_labels[ $profile_field_id ] ); ?></td> 168 <td><?php echo bp_members_admin_format_xprofile_field_for_display( $field_value ); ?></td> 169 </tr> 170 <?php endforeach; else: ?> 171 <tr> 172 <td><?php esc_html_e( 'There is no additional information to display.', 'buddypress' ); ?></td> 173 </tr> 174 <?php endif; ?> 175 </table> 176 </div> 177 <?php 178 } -
src/bp-members/bp-members-functions.php
diff --git src/bp-members/bp-members-functions.php src/bp-members/bp-members-functions.php index 141c545fa..9a389cdda 100644
function bp_core_signup_disable_inactive( $user = null, $username = '', $passwor 2449 2449 * when membership requests are enabled. 2450 2450 */ 2451 2451 if ( bp_get_membership_requests_required() ) { 2452 return new WP_Error( 'bp_account_not_activated', __( '<strong>Error</strong>: Your membership request has not yet been approved.', 'buddypress' ) ); 2452 $error_message = sprintf( 2453 '<strong>%1$s</strong> %2$s', 2454 esc_html_x( 'Error:', 'Warning used into the WP Login screen', 'buddypress' ), 2455 esc_html_x( 'Your membership request has not yet been approved.', 'Error message used into the WP Login screen', 'buddypress' ) 2456 ); 2453 2457 } else { 2454 2458 // Set up the feedback message. 2455 2459 $signup_id = $signup['signups'][0]->signup_id; … … function bp_core_signup_disable_inactive( $user = null, $username = '', $passwor 2464 2468 'bp-resend-activation' 2465 2469 ); 2466 2470 2467 $resend_string = '<br /><br />'; 2468 2469 /* translators: %s: the activation url */ 2470 $resend_string .= sprintf( __( 'If you have not received an email yet, <a href="%s">click here to resend it</a>.', 'buddypress' ), esc_url( $resend_url ) ); 2471 2472 return new WP_Error( 'bp_account_not_activated', __( '<strong>Error</strong>: Your account has not been activated. Check your email for the activation link.', 'buddypress' ) . $resend_string ); 2471 $error_message = sprintf( 2472 '<strong>%1$s</strong> %2$s<br /><br />%3$s', 2473 esc_html_x( 'Error:', 'Warning used into the WP Login screen', 'buddypress' ), 2474 esc_html_x( 'Your account has not been activated. Check your email for the activation link.', 'Error message used into the WP Login screen', 'buddypress' ), 2475 sprintf( 2476 /* translators: %s: the link to resend the activation email. */ 2477 esc_html_x( 'If you have not received an email yet, %s.', 'WP Login screen message', 'buddypress' ), 2478 sprintf( 2479 '<a href="%1$s">%2$s</a>', 2480 esc_url( $resend_url ), 2481 esc_html_x( 'click here to resend it', 'Text of the link to resend the activation email', 'buddypress' ) 2482 ) 2483 ) 2484 ); 2473 2485 } 2486 2487 return new WP_Error( 'bp_account_not_activated', $error_message ); 2474 2488 } 2475 2489 add_filter( 'authenticate', 'bp_core_signup_disable_inactive', 30, 3 ); 2476 2490 … … function bp_get_members_invitation_from_request() { 3708 3722 * @return bool|BP_Signup $signup Found signup, returns first found 3709 3723 * if more than one is found. 3710 3724 */ 3711 function bp_members_get_signup_by( $field = 'activation_key', $value ) {3725 function bp_members_get_signup_by( $field = 'activation_key', $value = '' ) { 3712 3726 switch ( $field ) { 3713 3727 case 'activation_key': 3714 3728 case 'user_email': -
src/bp-members/bp-members-invitations.php
diff --git src/bp-members/bp-members-invitations.php src/bp-members/bp-members-invitations.php index 7e95c791d..1924710cc 100644
function bp_members_invitations_maybe_bypass_request_approval( $send, $details ) 212 212 'invite_sent' => 'sent' 213 213 ) 214 214 ); 215 215 216 // If pending invitations exist, send the verification mail. 216 217 if ( $invites ) { 217 218 $send = true; 218 219 } 220 219 221 return $send; 220 222 } 221 223 add_filter( 'bp_members_membership_requests_bypass_manual_approval', 'bp_members_invitations_maybe_bypass_request_approval', 10, 2 ); -
src/bp-members/bp-members-membership-requests.php
diff --git src/bp-members/bp-members-membership-requests.php src/bp-members/bp-members-membership-requests.php index 2f217db7b..e1ab537ad 100644
add_filter( 'bp_core_signup_send_activation_key', 'bp_members_membership_request 84 84 function bp_members_membership_requests_notify_site_admins( $signup ) { 85 85 86 86 // Notify all site admins so the request can be handled. 87 $admins_query = new WP_User_Query( array( 88 'role' => 'administrator', 89 'fields' => 'ids' 90 ) ); 91 $admin_ids = $admins_query->get_results(); 87 $admin_ids = get_users( 88 array( 89 'fields' => 'ids', 90 'role' => 'administrator', 91 ) 92 ); 92 93 93 94 foreach ( $admin_ids as $admin_id ) { 94 95 // Trigger a BuddyPress Notification. 95 96 if ( bp_is_active( 'notifications' ) ) { 96 bp_notifications_add_notification( array( 97 'user_id' => $admin_id, 98 'item_id' => $signup->signup_id, 99 'component_name' => buddypress()->members->id, 100 'component_action' => 'membership_request_submitted', 101 'date_notified' => bp_core_current_time(), 102 'is_new' => 1, 103 ) ); 97 bp_notifications_add_notification( 98 array( 99 'user_id' => $admin_id, 100 'item_id' => $signup->signup_id, 101 'component_name' => buddypress()->members->id, 102 'component_action' => 'membership_request_submitted', 103 'date_notified' => bp_core_current_time(), 104 'is_new' => 1, 105 ) 106 ); 104 107 } 105 108 106 109 // Bail if member opted out of receiving this email. … … function bp_members_membership_requests_notify_site_admins( $signup ) { 112 115 'user_id' => $admin_id, 113 116 'notification_type' => 'members-membership-request', 114 117 ); 115 $manage_url = add_query_arg( array( 116 'mod_req' => 1, 117 'page' => 'bp-signups', 118 'signup_id' => $signup->signup_id, 119 'action' => 'resend', 120 ), bp_get_admin_url( 'users.php' ) ); 118 119 $manage_url = add_query_arg( 120 array( 121 'mod_req' => 1, 122 'page' => 'bp-signups', 123 'signup_id' => $signup->signup_id, 124 'action' => 'resend', 125 ), 126 bp_get_admin_url( 'users.php' ) 127 ); 128 121 129 $args = array( 122 130 'tokens' => array( 123 131 'admin.id' => $admin_id, … … function bp_members_membership_requests_notify_site_admins( $signup ) { 126 134 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ), 127 135 ), 128 136 ); 137 129 138 bp_send_email( 'members-membership-request', (int) $admin_id, $args ); 130 139 } 131 132 140 } 133 141 add_action( 'bp_members_membership_request_submitted', 'bp_members_membership_requests_notify_site_admins' ); 134 142 … … function bp_members_membership_requests_send_rejection_mail( $signup_ids ) { 146 154 'include' => $signup_ids, 147 155 ) 148 156 ); 157 149 158 if ( empty( $signups['signups'] ) ) { 150 159 return; 151 160 } 161 152 162 foreach ( $signups['signups'] as $signup ) { 153 163 if ( ! empty( $signup->user_email ) ) { 154 164 bp_send_email( 'members-membership-request-rejected', $signup->user_email ); … … function bp_members_membership_requests_filter_signup_row_actions( $actions, $si 222 232 223 233 $resend_label = ( 0 === $signup_object->count_sent ) ? __( 'Approve Request', 'buddypress' ) : __( 'Resend Approval', 'buddypress' ); 224 234 225 $actions['resend'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $email_link ), $resend_label);235 $actions['resend'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $email_link ), esc_html( $resend_label ) ); 226 236 227 237 // Add a link to view profile info when membership requests and xprofile are active. 228 238 if ( bp_is_active( 'xprofile' ) ) { … … function bp_members_membership_requests_filter_signup_row_actions( $actions, $si 234 244 bp_get_admin_url( 'users.php' ) 235 245 ); 236 246 237 $actions['profile'] = sprintf( '<a href="%1$s" class=" thickbox">%2$s</a>', esc_url( $profile_link ),__( 'Profile Info', 'buddypress' ) );247 $actions['profile'] = sprintf( '<a href="%1$s" class="bp-thickbox">%2$s</a>', esc_url( $profile_link ), esc_html__( 'Profile Info', 'buddypress' ) ); 238 248 } 239 249 240 250 return $actions; … … add_filter( 'bp_members_ms_signup_row_actions', 'bp_members_membership_requests_ 246 256 * 247 257 * @since 10.0.0 248 258 * 249 * @param array $actions Array of actions and corresponding links. 259 * @param array $actions Array of actions and corresponding links. 260 * @return array List of actions and corresponding links. 250 261 */ 251 262 function bp_members_membership_requests_filter_signup_bulk_actions( $actions ) { 252 263 // Rename the "email" resend option when membership requests are active. 253 $actions['resend'] = _x( 'Approve', 'Pending signup action', 'buddypress' );264 $actions['resend'] = esc_html_x( 'Approve', 'Pending signup action', 'buddypress' ); 254 265 return $actions; 255 266 } 256 267 add_filter( 'bp_members_ms_signup_bulk_actions', 'bp_members_membership_requests_filter_signup_bulk_actions' ); … … add_filter( 'bp_members_ms_signup_bulk_actions', 'bp_members_membership_requests 260 271 * 261 272 * @since 10.0.0 262 273 * 263 * @param array $value Array of columns to display. 274 * @param array $columns Array of columns to display. 275 * @return array List of columns to display. 264 276 */ 265 277 function bp_members_membership_requests_filter_signup_table_date_sent_header( $columns ) { 266 $columns['date_sent'] = __( 'Approved', 'buddypress' );278 $columns['date_sent'] = esc_html__( 'Approved', 'buddypress' ); 267 279 return $columns; 268 280 } 269 281 add_filter( 'bp_members_signup_columns', 'bp_members_membership_requests_filter_signup_table_date_sent_header' ); … … add_filter( 'bp_members_ms_signup_columns', 'bp_members_membership_requests_filt 276 288 * 277 289 * @param string $message "Not yet sent" message. 278 290 * @param object|null $signup Signup object instance. 291 * @return string "Not yet approved" message, if needed. Unchanged message otherwise. 279 292 */ 280 293 function bp_members_membership_requests_filter_signup_table_unsent_message( $message, $signup ) { 281 294 if ( 0 === $signup->count_sent ) { 282 $message = __( 'Not yet approved', 'buddypress' );295 $message = esc_html__( 'Not yet approved', 'buddypress' ); 283 296 } 297 284 298 return $message; 285 299 } 286 300 add_filter( 'bp_members_signup_date_sent_unsent_message', 'bp_members_membership_requests_filter_signup_table_unsent_message', 10, 2 ); … … add_filter( 'bp_members_ms_signup_date_sent_unsent_message', 'bp_members_members 288 302 289 303 /** 290 304 * Filter/add "Request Membership" links in the following locations: 291 * BP login widget292 * sidebar register link293 * WP Toolbar294 * WP login form305 * - BP login widget, 306 * - Sidebar register link, 307 * - WP Toolbar, 308 * - WP login form. 295 309 *********************************************************************/ 296 310 297 311 /** … … add_action( 'bp_login_widget_form', 'bp_members_membership_requests_add_link_to_ 315 329 * @since 10.0.0 316 330 * 317 331 * @param string $link The HTML code for the link to the Registration or Admin page. 332 * @return string An empty string or the HTML code for the link to the Membership request page. 318 333 */ 319 334 function bp_members_membership_requests_filter_sidebar_register_link( $link ) { 320 335 // $link should be an empty string when public registration is disabled. 321 336 if ( ! is_user_logged_in() && empty( $link ) ) { 322 // @TODO: How can we know what before and after tags should be? 323 $link = '<li><a href="' . esc_url( wp_registration_url() ) . '">' . __( 'Request Membership' ) . '</a><li>'; 337 $link = '<a href="' . esc_url( wp_registration_url() ) . '">' . esc_html__( 'Request Membership', 'buddypress' ) . '</a>'; 324 338 } 339 325 340 return $link; 326 341 } 327 342 add_filter( 'register', 'bp_members_membership_requests_filter_sidebar_register_link' ); … … function bp_members_membership_requests_add_toolbar_link( $wp_admin_bar ) { 341 356 342 357 $args = array( 343 358 'id' => 'bp-request-membership', 344 'title' => __( 'Request Membership' ),359 'title' => __( 'Request Membership', 'buddypress' ), 345 360 'href' => wp_registration_url(), 346 361 'meta' => array( 347 362 'class' => 'buddypress-request-membership', 348 'title' => __( 'Request Membership' )363 'title' => __( 'Request Membership', 'buddypress' ), 349 364 ), 350 365 ); 366 351 367 $wp_admin_bar->add_node( $args ); 352 368 } 353 369 add_action( 'admin_bar_menu', 'bp_members_membership_requests_add_toolbar_link', 21 ); … … add_action( 'admin_bar_menu', 'bp_members_membership_requests_add_toolbar_link', 358 374 * @since 10.0.0 359 375 * 360 376 * @param string $link HTML link to the home URL of the current site. 377 * @return string HTML link to the home URL of the current site and the one to request a membership. 361 378 */ 362 379 function bp_members_membership_requests_add_link_wp_login( $link ) { 363 return $link . ' | ' . '<a href="' . esc_url( wp_registration_url() ) . '">' . __( 'Request Membership' ) . '</a>'; 380 $link_separator = apply_filters( 'login_link_separator', ' | ' ); 381 382 return $link . $link_separator . '<a href="' . esc_url( wp_registration_url() ) . '">' . esc_html__( 'Request Membership', 'buddypress' ) . '</a>'; 364 383 } 365 384 add_action( 'login_site_html_link', 'bp_members_membership_requests_add_link_wp_login' ); -
src/bp-members/bp-members-notifications.php
diff --git src/bp-members/bp-members-notifications.php src/bp-members/bp-members-notifications.php index 34c2677e9..b84a0938a 100644
function bp_members_mark_read_accepted_invitation_notification() { 191 191 'is_new' => false, 192 192 ), 193 193 array( 194 'user_id' 195 'item_id' 196 'component_action' 194 'user_id' => bp_loggedin_user_id(), 195 'item_id' => bp_displayed_user_id(), 196 'component_action' => 'accepted_invitation', 197 197 ) 198 198 ); 199 199 } -
src/bp-members/classes/class-bp-members-admin.php
diff --git src/bp-members/classes/class-bp-members-admin.php src/bp-members/classes/class-bp-members-admin.php index 7c352d0c1..6c94cf20c 100644
class BP_Members_Admin { 1693 1693 */ 1694 1694 $allowed_actions = apply_filters( 'bp_signups_admin_allowed_actions', array( 'do_delete', 'do_activate', 'do_resend' ) ); 1695 1695 1696 // Prepare the display of the Community Profilescreen.1696 // Prepare the display of the Signups screen. 1697 1697 if ( ! in_array( $doaction, $allowed_actions ) || ( -1 == $doaction ) ) { 1698 1698 1699 1699 if ( is_network_admin() ) { … … class BP_Members_Admin { 1715 1715 '<p>' . __( 'Using the search form, you can find pending accounts more easily. The Username and Email fields will be included in the search.', 'buddypress' ) . '</p>' 1716 1716 ) ); 1717 1717 1718 $signup_help_content = '<p>' . __( 'Hovering over a row in the pending accounts list will display action links that allow you to manage pending accounts. You can perform the following actions:', 'buddypress' ) . '</p>';1718 $signup_help_content = '<p>' . esc_html__( 'Hovering over a row in the pending accounts list will display action links that allow you to manage pending accounts. You can perform the following actions:', 'buddypress' ) . '</p>'; 1719 1719 1720 1720 if ( bp_get_membership_requests_required() ) { 1721 $signup_help_content .= '<ul><li>' . __( '"Activate" will activate the user immediately without requiring that they validate their email.', 'buddypress' ) .'</li>' .1722 '<li>' . __( '"Approve Request"/"Resend Apprival" takes you to the confirmation screen before being able to send the activation link to the desired pending request. You can only send the activation email once per day.', 'buddypress' ) . '</li>';1721 $signup_help_content .= '<ul><li>' . esc_html__( '"Activate" will activate the user immediately without requiring that they validate their email.', 'buddypress' ) .'</li>' . 1722 '<li>' . esc_html__( '"Approve Request" or "Resend Approval" takes you to the confirmation screen before being able to send the activation link to the desired pending request. You can only send the activation email once per day.', 'buddypress' ) . '</li>'; 1723 1723 1724 1724 if ( bp_is_active( 'xprofile' ) ) { 1725 $signup_help_content .= '<li>' . __( '"Profile Info" will display extended profile information for the request.', 'buddypress' ) . '</li>';1725 $signup_help_content .= '<li>' . esc_html__( '"Profile Info" will display extended profile information for the request.', 'buddypress' ) . '</li>'; 1726 1726 } 1727 1727 1728 $signup_help_content .= '<li>' . __( '"Delete" allows you to delete a pending account from your site. You will be asked to confirm this deletion.', 'buddypress' ) . '</li></ul>';1728 $signup_help_content .= '<li>' . esc_html__( '"Delete" allows you to delete a pending account from your site. You will be asked to confirm this deletion.', 'buddypress' ) . '</li></ul>'; 1729 1729 } else { 1730 $signup_help_content .= '<ul><li>' . __( '"Email" takes you to the confirmation screen before being able to send the activation link to the desired pending account. You can only send the activation email once per day.', 'buddypress' ) . '</li>' .1730 $signup_help_content .= '<ul><li>' . esc_html__( '"Email" takes you to the confirmation screen before being able to send the activation link to the desired pending account. You can only send the activation email once per day.', 'buddypress' ) . '</li>' . 1731 1731 '<li>' . __( '"Delete" allows you to delete a pending account from your site. You will be asked to confirm this deletion.', 'buddypress' ) . '</li></ul>'; 1732 1732 } 1733 1733 1734 $signup_help_content .= '<p>' . __( 'By clicking on a Username you will be able to activate a pending account from the confirmation screen.', 'buddypress' ) . '</p>' .1734 $signup_help_content .= '<p>' . esc_html__( 'By clicking on a Username you will be able to activate a pending account from the confirmation screen.', 'buddypress' ) . '</p>' . 1735 1735 '<p>' . __( 'Bulk actions allow you to perform these 3 actions for the selected rows.', 'buddypress' ) . '</p>'; 1736 1736 1737 1737 get_current_screen()->add_help_tab( array( … … class BP_Members_Admin { 1742 1742 1743 1743 // Help panel - sidebar links. 1744 1744 get_current_screen()->set_help_sidebar( 1745 '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .1745 '<p><strong>' . esc_html__( 'For more information:', 'buddypress' ) . '</strong></p>' . 1746 1746 '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>' 1747 1747 ); 1748 1748 … … class BP_Members_Admin { 1756 1756 'heading_list' => __( 'Pending users list', 'buddypress' ), 1757 1757 ) ); 1758 1758 1759 // Use thickbox to display the extended profile information. 1760 if ( bp_is_active( 'xprofile' ) ) { 1761 wp_enqueue_style( 'thickbox' ); 1762 wp_enqueue_script( 1763 'bp-signup-preview', 1764 $this->js_url . 'signup-preview' . bp_core_get_minified_asset_suffix() . '.js', 1765 array( 'bp-thickbox', 'jquery' ), 1766 bp_get_version(), 1767 true 1768 ); 1769 wp_localize_script( 1770 'bp-signup-preview', 1771 'bpSignupPreview', 1772 array( 1773 'modalLabel' => __( 'Profile info preview', 'buddypress' ), 1774 ) 1775 ); 1776 } 1777 1759 1778 } else { 1760 1779 if ( ! empty( $_REQUEST['signup_ids' ] ) ) { 1761 1780 $signups = wp_parse_id_list( $_REQUEST['signup_ids' ] ); … … class BP_Members_Admin { 2351 2370 $field_value = isset( $signup->meta[ "field_{$pid}" ] ) ? $signup->meta[ "field_{$pid}" ] : ''; ?> 2352 2371 <tr> 2353 2372 <td class="column-fields"><?php echo esc_html( $fdata[ $pid ] ); ?></td> 2354 <td><?php echo $this->format_xprofile_field_for_display( $field_value ); ?></td>2373 <td><?php echo bp_members_admin_format_xprofile_field_for_display( $field_value ); ?></td> 2355 2374 </tr> 2356 2375 2357 2376 <?php endforeach; ?> … … class BP_Members_Admin { 2657 2676 * Operates recursively on arrays, which are then imploded with commas. 2658 2677 * 2659 2678 * @since 2.8.0 2679 * @deprecated 10.0.0 2660 2680 * 2661 2681 * @param string|array $value Field value. 2662 2682 * @return string 2663 2683 */ 2664 2684 protected function format_xprofile_field_for_display( $value ) { 2665 if ( is_array( $value ) ) { 2666 $value = array_map( array( $this, 'format_xprofile_field_for_display' ), $value ); 2667 $value = implode( ', ', $value ); 2668 } else { 2669 $value = stripslashes( $value ); 2670 $value = esc_html( $value ); 2671 } 2685 _deprecated_function( __METHOD__, '10.0.0', 'bp_members_admin_format_xprofile_field_for_display' ); 2672 2686 2673 return $value;2687 return bp_members_admin_format_xprofile_field_for_display( $value ); 2674 2688 } 2675 2689 2676 2690 /** -
src/bp-members/classes/class-bp-members-component.php
diff --git src/bp-members/classes/class-bp-members-component.php src/bp-members/classes/class-bp-members-component.php index 135fb10ca..dca58193e 100644
class BP_Members_Component extends BP_Component { 40 40 array( 41 41 'adminbar_myaccount_order' => 20, 42 42 'search_query_arg' => 'members_search', 43 'features' => array( 'invitations', 'membership_requests' ) 43 'features' => array( 'invitations', 'membership_requests' ), 44 44 ) 45 45 ); 46 46 } -
src/bp-members/classes/class-bp-members-list-table.php
diff --git src/bp-members/classes/class-bp-members-list-table.php src/bp-members/classes/class-bp-members-list-table.php index d9922b1fe..0dcf21d7c 100644
class BP_Members_List_Table extends WP_Users_List_Table { 26 26 */ 27 27 public $signup_counts = 0; 28 28 29 /** 30 * Signup profile fields. 31 * 32 * @since 10.0.0 33 * 34 * @var array 35 */ 36 public $signup_field_labels = array(); 37 29 38 /** 30 39 * Constructor. 31 40 * … … class BP_Members_List_Table extends WP_Users_List_Table { 113 122 114 123 // Reset the screen id. 115 124 $this->screen->id = $reset_screen_id; 116 117 // Use thickbox to display the extended profile information.118 if ( bp_is_active( 'xprofile' ) ) {119 add_thickbox();120 }121 125 } 122 126 123 127 /** … … class BP_Members_List_Table extends WP_Users_List_Table { 364 368 365 369 $profile_field_ids = array(); 366 370 367 // Prefetch registration field data. 368 $fdata = array(); 369 $field_groups = bp_xprofile_get_groups( array( 370 'exclude_fields' => 1, 371 'update_meta_cache' => false, 372 'fetch_fields' => true, 373 ) ); 374 375 foreach( $field_groups as $fg ) { 376 foreach( $fg->fields as $f ) { 377 $fdata[ $f->id ] = $f->name; 371 // Fetch registration field data once only. 372 if ( ! $this->signup_field_labels ) { 373 $field_groups = bp_xprofile_get_groups( 374 array( 375 'fetch_fields' => true, 376 'signup_fields_only' => true, 377 ) 378 ); 379 380 foreach( $field_groups as $field_group ) { 381 foreach( $field_group->fields as $field ) { 382 $this->signup_field_labels[ $field->id ] = $field->name; 383 } 378 384 } 379 385 } 380 386 381 // Get all xprofile field IDs except field 1. 382 if ( ! empty( $signup_object->meta['profile_field_ids'] ) ) { 383 $profile_field_ids = array_flip( explode( ',', $signup_object->meta['profile_field_ids'] ) ); 384 unset( $profile_field_ids[1] ); 385 } 386 ?> 387 <div id="signup-info-modal-<?php echo $signup_object->id; ?>" style="display:none;"> 388 <h1><?php printf( esc_html__( '%1$s (%2$s)', 'buddypress' ), esc_html( $signup_object->user_name ), esc_html( $signup_object->user_email ) ); ?></h1> 389 <h2><?php echo esc_html__( 'Extended Profile Information', 'buddypress' ); ?></h2> 390 391 <table class="signup-profile-data-drawer wp-list-table widefat fixed striped"> 392 <?php if ( 1 <= count( $profile_field_ids ) ): foreach ( $profile_field_ids as $pid => $noop ) : 393 $field_value = isset( $signup_object->meta[ "field_{$pid}" ] ) ? $signup_object->meta[ "field_{$pid}" ] : ''; ?> 394 <tr> 395 <td class="column-fields"><?php echo esc_html( $fdata[ $pid ] ); ?></td> 396 <td><?php echo $this->format_xprofile_field_for_display( $field_value ); ?></td> 397 </tr> 398 <?php endforeach; else: ?> 399 <tr> 400 <td><?php esc_html_e( 'There is no additional information to display.', 'buddypress' ); ?></td> 401 </tr> 402 <?php endif; ?> 403 </table> 404 </div> 405 <?php 387 bp_members_admin_preview_signup_profile_info( $this->signup_field_labels, $signup_object ); 406 388 } 407 389 408 390 /** … … class BP_Members_List_Table extends WP_Users_List_Table { 424 406 * @param object|null $signup_object The signup data object. 425 407 */ 426 408 public function column_registered( $signup_object = null ) { 427 echo mysql2date( 'Y/m/d ', $signup_object->registered );409 echo mysql2date( 'Y/m/d g:i:s a', $signup_object->registered ); 428 410 } 429 411 430 412 /** … … class BP_Members_List_Table extends WP_Users_List_Table { 436 418 */ 437 419 public function column_date_sent( $signup_object = null ) { 438 420 if ( $signup_object->count_sent > 0 ) { 439 echo mysql2date( 'Y/m/d ', $signup_object->date_sent );421 echo mysql2date( 'Y/m/d g:i:s a', $signup_object->date_sent ); 440 422 } else { 441 423 $message = __( 'Not yet notified', 'buddypress' ); 442 424 … … class BP_Members_List_Table extends WP_Users_List_Table { 487 469 */ 488 470 return apply_filters( 'bp_members_signup_custom_column', '', $column_name, $signup_object ); 489 471 } 490 491 /**492 * Formats a signup's xprofile field data for display.493 *494 * Operates recursively on arrays, which are then imploded with commas.495 *496 * @since 10.0.0497 * @see BP_Members_Admin::format_xprofile_field_for_display()498 *499 * @param string|array $value Field value.500 * @return string501 */502 protected function format_xprofile_field_for_display( $value ) {503 if ( is_array( $value ) ) {504 $value = array_map( array( $this, 'format_xprofile_field_for_display' ), $value );505 $value = implode( ', ', $value );506 } else {507 $value = stripslashes( $value );508 $value = esc_html( $value );509 }510 511 return $value;512 }513 472 } -
src/bp-members/classes/class-bp-members-ms-list-table.php
diff --git src/bp-members/classes/class-bp-members-ms-list-table.php src/bp-members/classes/class-bp-members-ms-list-table.php index 662146c78..318506ae1 100644
class BP_Members_MS_List_Table extends WP_MS_Users_List_Table { 350 350 351 351 $profile_field_ids = array(); 352 352 353 // Prefetch registration field data. 354 $fdata = array(); 355 $field_groups = bp_xprofile_get_groups( array( 356 'exclude_fields' => 1, 357 'update_meta_cache' => false, 358 'fetch_fields' => true, 359 ) ); 360 361 foreach( $field_groups as $fg ) { 362 foreach( $fg->fields as $f ) { 363 $fdata[ $f->id ] = $f->name; 353 // Fetch registration field data once only. 354 if ( ! $this->signup_field_labels ) { 355 $field_groups = bp_xprofile_get_groups( 356 array( 357 'fetch_fields' => true, 358 'signup_fields_only' => true, 359 ) 360 ); 361 362 foreach( $field_groups as $field_group ) { 363 foreach( $field_group->fields as $field ) { 364 $this->signup_field_labels[ $field->id ] = $field->name; 365 } 364 366 } 365 367 } 366 368 367 // Get all xprofile field IDs except field 1. 368 if ( ! empty( $signup_object->meta['profile_field_ids'] ) ) { 369 $profile_field_ids = array_flip( explode( ',', $signup_object->meta['profile_field_ids'] ) ); 370 unset( $profile_field_ids[1] ); 371 } 372 ?> 373 <div id="signup-info-modal-<?php echo $signup_object->id; ?>" style="display:none;"> 374 <h1><?php printf( esc_html__( '%1$s (%2$s)', 'buddypress' ), esc_html( $signup_object->user_name ), esc_html( $signup_object->user_email ) ); ?></h1> 375 <h2><?php echo esc_html__( 'Extended Profile Information', 'buddypress' ); ?></h2> 376 377 <table class="signup-profile-data-drawer wp-list-table widefat fixed striped"> 378 <?php if ( 1 <= count( $profile_field_ids ) ): foreach ( $profile_field_ids as $pid => $noop ) : 379 $field_value = isset( $signup_object->meta[ "field_{$pid}" ] ) ? $signup_object->meta[ "field_{$pid}" ] : ''; ?> 380 <tr> 381 <td class="column-fields"><?php echo esc_html( $fdata[ $pid ] ); ?></td> 382 <td><?php echo $this->format_xprofile_field_for_display( $field_value ); ?></td> 383 </tr> 384 <?php endforeach;else: ?> 385 <tr> 386 <td><?php esc_html_e( 'There is no additional information to display.', 'buddypress' ); ?></td> 387 </tr> 388 <?php endif; ?> 389 </table> 390 </div> 391 <?php 369 bp_members_admin_preview_signup_profile_info( $this->signup_field_labels, $signup_object ); 392 370 } 393 371 394 372 /** … … class BP_Members_MS_List_Table extends WP_MS_Users_List_Table { 489 467 */ 490 468 return apply_filters( 'bp_members_ms_signup_custom_column', '', $column_name, $signup_object ); 491 469 } 492 493 /**494 * Formats a signup's xprofile field data for display.495 *496 * Operates recursively on arrays, which are then imploded with commas.497 *498 * @since 10.0.0499 * @see BP_Members_Admin::format_xprofile_field_for_display()500 *501 * @param string|array $value Field value.502 * @return string503 */504 protected function format_xprofile_field_for_display( $value ) {505 if ( is_array( $value ) ) {506 $value = array_map( array( $this, 'format_xprofile_field_for_display' ), $value );507 $value = implode( ', ', $value );508 } else {509 $value = stripslashes( $value );510 $value = esc_html( $value );511 }512 513 return $value;514 }515 470 }