diff --git src/bp-members/bp-members-functions.php src/bp-members/bp-members-functions.php
index d940b9a5f..1d353c40b 100644
|
|
add_action( bp_get_member_type_tax_name() . '_add_form', 'bp_insert_member_types |
2975 | 2975 | * false to replace. Default: false. |
2976 | 2976 | * @return false|array $retval See {@see bp_set_object_terms()}. |
2977 | 2977 | */ |
2978 | | function bp_set_member_type( $user_id, $member_type, $append = false ) { |
| 2978 | function bp_set_member_type( $user_id, $member_types, $append = false ) { |
| 2979 | |
2979 | 2980 | // Pass an empty $member_type to remove a user's type. |
2980 | | if ( ! empty( $member_type ) && ! bp_get_member_type_object( $member_type ) ) { |
| 2981 | if ( empty( $member_types ) && ! is_array( $member_types ) ) { |
2981 | 2982 | return false; |
2982 | 2983 | } |
2983 | 2984 | |
2984 | | $retval = bp_set_object_terms( $user_id, $member_type, bp_get_member_type_tax_name(), $append ); |
| 2985 | $retval = bp_set_object_terms( $user_id, $member_types, bp_get_member_type_tax_name(), $append ); |
2985 | 2986 | |
2986 | 2987 | // Bust the cache if the type has been updated. |
2987 | 2988 | if ( ! is_wp_error( $retval ) ) { |
… |
… |
function bp_set_member_type( $user_id, $member_type, $append = false ) { |
2996 | 2997 | * @param string $member_type Member type. |
2997 | 2998 | * @param bool $append Whether the type is being appended to existing types. |
2998 | 2999 | */ |
2999 | | do_action( 'bp_set_member_type', $user_id, $member_type, $append ); |
| 3000 | do_action( 'bp_set_member_type', $user_id, $member_types, $append ); |
3000 | 3001 | } |
3001 | 3002 | |
3002 | 3003 | return $retval; |
diff --git src/bp-members/classes/class-bp-members-admin.php src/bp-members/classes/class-bp-members-admin.php
index d344b5d7c..d58b4c891 100644
|
|
class BP_Members_Admin { |
1286 | 1286 | return; |
1287 | 1287 | } |
1288 | 1288 | |
1289 | | $types = bp_get_member_types( array(), 'objects' ); |
1290 | | $current_type = bp_get_member_type( $user->ID ); |
| 1289 | $types = bp_get_member_types( array(), 'object' ); |
| 1290 | $current_types = bp_get_member_type( $user->ID, false ); |
| 1291 | $selected = ''; |
1291 | 1292 | ?> |
1292 | | |
1293 | | <label for="bp-members-profile-member-type" class="screen-reader-text"><?php |
| 1293 | <label for="bp-members-profile-member-type" class="screen-reader-text"> |
| 1294 | <?php |
1294 | 1295 | /* translators: accessibility text */ |
1295 | 1296 | esc_html_e( 'Select member type', 'buddypress' ); |
1296 | | ?></label> |
1297 | | <select name="bp-members-profile-member-type" id="bp-members-profile-member-type"> |
1298 | | <option value="" <?php selected( '', $current_type ); ?>><?php |
1299 | | /* translators: no option picked in select box */ |
1300 | | esc_attr_e( '----', 'buddypress' ); |
1301 | | ?></option> |
| 1297 | ?> |
| 1298 | </label> |
| 1299 | |
| 1300 | <select name="bp-members-profile-member-type[]" id="bp-members-profile-member-type" multiple="multiple"> |
| 1301 | <option value=""><?php |
| 1302 | |
| 1303 | /* translators: no option picked in select box */ |
| 1304 | esc_attr_e( '----', 'buddypress' ); |
| 1305 | ?> |
| 1306 | </option> |
1302 | 1307 | <?php foreach ( $types as $type ) : ?> |
1303 | | <option value="<?php echo esc_attr( $type->name ) ?>" <?php selected( $type->name, $current_type ) ?>><?php echo esc_html( $type->labels['singular_name'] ) ?></option> |
| 1308 | <?php if( ! empty( $current_types ) && in_array( $type->name, $current_types ) ){ |
| 1309 | $selected = 'selected'; |
| 1310 | }else { |
| 1311 | $selected = ''; |
| 1312 | }?> |
| 1313 | <option value="<?php echo esc_attr( $type->name ); ?>" <?php echo esc_attr( $selected );?>><?php echo esc_html( $type->labels['singular_name'] ); ?></option> |
1304 | 1314 | <?php endforeach; ?> |
1305 | 1315 | </select> |
1306 | 1316 | |
… |
… |
class BP_Members_Admin { |
1309 | 1319 | wp_nonce_field( 'bp-member-type-change-' . $user->ID, 'bp-member-type-nonce' ); |
1310 | 1320 | } |
1311 | 1321 | |
| 1322 | |
1312 | 1323 | /** |
1313 | 1324 | * Process changes from the Member Type metabox. |
1314 | 1325 | * |
… |
… |
class BP_Members_Admin { |
1320 | 1331 | } |
1321 | 1332 | |
1322 | 1333 | $user_id = $this->get_user_id(); |
| 1334 | $member_types = array(); |
1323 | 1335 | |
1324 | 1336 | check_admin_referer( 'bp-member-type-change-' . $user_id, 'bp-member-type-nonce' ); |
1325 | 1337 | |
… |
… |
class BP_Members_Admin { |
1328 | 1340 | return; |
1329 | 1341 | } |
1330 | 1342 | |
1331 | | // Member type string must either reference a valid member type, or be empty. |
1332 | | $member_type = stripslashes( $_POST['bp-members-profile-member-type'] ); |
1333 | | if ( ! empty( $member_type ) && ! bp_get_member_type_object( $member_type ) ) { |
1334 | | return; |
| 1343 | |
| 1344 | foreach ( $_POST['bp-members-profile-member-type'] as $key => $types ) { |
| 1345 | // Member type string must either reference a valid member type, or be empty. |
| 1346 | $member_type = stripslashes( $types ); |
| 1347 | if ( ! empty( $member_type ) && ! bp_get_member_type_object( $member_type ) ) { |
| 1348 | return; |
| 1349 | } |
| 1350 | |
| 1351 | $member_types[$key] = $member_type; |
1335 | 1352 | } |
1336 | 1353 | |
| 1354 | |
1337 | 1355 | /* |
1338 | 1356 | * If an invalid member type is passed, someone's doing something |
1339 | 1357 | * fishy with the POST request, so we can fail silently. |
1340 | 1358 | */ |
1341 | | if ( bp_set_member_type( $user_id, $member_type ) ) { |
| 1359 | if ( bp_set_member_type( $user_id, $member_types ) ) { |
1342 | 1360 | // @todo Success messages can't be posted because other stuff happens on the page load. |
1343 | 1361 | } |
1344 | 1362 | } |
… |
… |
class BP_Members_Admin { |
2319 | 2337 | |
2320 | 2338 | // `$which` is only passed in WordPress 4.6+. Avoid duplicating controls in earlier versions. |
2321 | 2339 | static $displayed = false; |
| 2340 | $counter = 0; |
2322 | 2341 | if ( version_compare( bp_get_major_wp_version(), '4.6', '<' ) && $displayed ) { |
2323 | 2342 | return; |
2324 | 2343 | } |
… |
… |
class BP_Members_Admin { |
2326 | 2345 | |
2327 | 2346 | $id_name = 'bottom' === $which ? 'bp_change_type2' : 'bp_change_type'; |
2328 | 2347 | |
2329 | | $types = bp_get_member_types( array(), 'objects' ); ?> |
| 2348 | $types = bp_get_member_types( array(), 'objects' ); |
| 2349 | ?> |
2330 | 2350 | |
2331 | | <label class="screen-reader-text" for="<?php echo $id_name; ?>"><?php _e( 'Change member type to…', 'buddypress' ) ?></label> |
2332 | | <select name="<?php echo $id_name; ?>" id="<?php echo $id_name; ?>" style="display:inline-block;float:none;"> |
2333 | | <option value=""><?php _e( 'Change member type to…', 'buddypress' ) ?></option> |
| 2351 | <label class="screen-reader-text" for="<?php echo $id_name; ?>"><?php _e( 'Change member type to…', 'buddypress' ); ?></label> |
2334 | 2352 | |
2335 | | <?php foreach( $types as $type ) : ?> |
| 2353 | <select name="<?php echo $id_name; ?>" id="<?php echo $id_name; ?>" style="display:inline-block;float:none;"> |
| 2354 | <option value=""><?php _e( 'Change member type to…', 'buddypress' ); ?></option> |
2336 | 2355 | |
2337 | | <option value="<?php echo esc_attr( $type->name ); ?>"><?php echo esc_html( $type->labels['singular_name'] ); ?></option> |
| 2356 | <?php foreach ( $types as $type ) : ?> |
2338 | 2357 | |
2339 | | <?php endforeach; ?> |
| 2358 | <option value="<?php echo esc_attr( $type->name ); ?>"><?php echo esc_html( $type->labels['singular_name'] ); ?></option> |
| 2359 | |
| 2360 | <?php endforeach; ?> |
| 2361 | |
| 2362 | <option value="remove_member_type"><?php _e( 'No Member Type', 'buddypress' ); ?></option> |
| 2363 | |
| 2364 | </select> |
2340 | 2365 | |
2341 | | <option value="remove_member_type"><?php _e( 'No Member Type', 'buddypress' ) ?></option> |
2342 | 2366 | |
2343 | | </select> |
2344 | 2367 | <?php |
2345 | 2368 | wp_nonce_field( 'bp-bulk-users-change-type-' . bp_loggedin_user_id(), 'bp-bulk-users-change-type-nonce' ); |
2346 | 2369 | submit_button( __( 'Change', 'buddypress' ), 'button', 'bp_change_member_type', false ); |
| 2370 | |
2347 | 2371 | } |
2348 | 2372 | |
2349 | 2373 | /** |
… |
… |
class BP_Members_Admin { |
2466 | 2490 | * |
2467 | 2491 | * @param string $retval |
2468 | 2492 | * @param string $column_name |
2469 | | * @param int $user_id |
| 2493 | * @param int $user_id |
2470 | 2494 | * |
2471 | 2495 | * @return string Member type as a link to filter all users. |
2472 | 2496 | */ |
… |
… |
class BP_Members_Admin { |
2477 | 2501 | } |
2478 | 2502 | |
2479 | 2503 | // Get the member type. |
2480 | | $type = bp_get_member_type( $user_id ); |
| 2504 | $types = bp_get_member_type( $user_id, false ); |
2481 | 2505 | |
2482 | | // Output the |
2483 | | if ( $type_obj = bp_get_member_type_object( $type ) ) { |
2484 | | $url = add_query_arg( array( 'bp-member-type' => urlencode( $type ) ) ); |
2485 | | $retval = '<a href="' . esc_url( $url ) . '">' . esc_html( $type_obj->labels['singular_name'] ) . '</a>'; |
2486 | | } |
| 2506 | if( ! empty( $types ) ){ |
2487 | 2507 | |
2488 | | return $retval; |
| 2508 | $member_types = ''; |
| 2509 | |
| 2510 | if ( count( $types ) > 5 ) { |
| 2511 | $types = array_slice( $types, 0, 5 ); |
| 2512 | } |
| 2513 | |
| 2514 | foreach ( $types as $key => $type ) { |
| 2515 | // Output the |
| 2516 | if ( $type_obj = bp_get_member_type_object( $type ) ) { |
| 2517 | |
| 2518 | if ( ! empty( $member_types ) ) { |
| 2519 | $member_types .= ', '; |
| 2520 | } |
| 2521 | |
| 2522 | $url = add_query_arg( array( 'bp-member-type' => urlencode( $type ) ) ); |
| 2523 | $member_types .= '<a href="' . esc_url( $url ) . '">' . esc_html( $type_obj->labels['singular_name'] ) . '</a>'; |
| 2524 | } |
| 2525 | } |
| 2526 | |
| 2527 | if ( ! empty( $member_types ) ) { |
| 2528 | $retval .= '<br />' . $member_types; |
| 2529 | } |
| 2530 | return $retval; |
| 2531 | } |
2489 | 2532 | } |
2490 | 2533 | |
2491 | 2534 | /** |
diff --git src/bp-members/classes/class-bp-signup.php src/bp-members/classes/class-bp-signup.php
index e857b9209..93b6087f8 100644
|
|
class BP_Signup { |
160 | 160 | 'bp_core_signups_get_args' |
161 | 161 | ); |
162 | 162 | |
163 | | // Whitelist sanitization. |
| 163 | // Make sure the orderby clause is allowed. |
164 | 164 | if ( ! in_array( $r['orderby'], array( 'login', 'email', 'registered', 'activated' ), true ) ) { |
165 | 165 | $r['orderby'] = 'signup_id'; |
166 | 166 | } |
diff --git src/bp-templates/bp-legacy/js/password-verify.js src/bp-templates/bp-legacy/js/password-verify.js
index 47c01f7e9..14e530c22 100644
|
|
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | | strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2 ); |
| 17 | // wp.passwordStrength.userInputBlacklist() has been deprecated in WP 5.5.0. |
| 18 | if ( 'function' === typeof wp.passwordStrength.userInputDisallowedList ) { |
| 19 | strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputDisallowedList(), pass2 ); |
| 20 | } else { |
| 21 | strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2 ); |
| 22 | } |
18 | 23 | |
19 | 24 | switch ( strength ) { |
20 | 25 | case 2: |
diff --git src/bp-templates/bp-nouveau/js/password-verify.js src/bp-templates/bp-nouveau/js/password-verify.js
index a0f9e278d..db822f16c 100644
|
|
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
24 | | strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2 ); |
| 24 | // wp.passwordStrength.userInputBlacklist() has been deprecated in WP 5.5.0. |
| 25 | if ( 'function' === typeof wp.passwordStrength.userInputDisallowedList ) { |
| 26 | strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputDisallowedList(), pass2 ); |
| 27 | } else { |
| 28 | strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2 ); |
| 29 | } |
25 | 30 | |
26 | 31 | switch ( strength ) { |
27 | 32 | case 2: |