bp_groups_admin_edit_metabox_members( BP_Groups_Group $item )
Renders the Members metabox on single group pages.
Description
Parameters
- $item
-
(Required) The BP_Groups_Group object for the current group.
Source
File: bp-groups/bp-groups-admin.php
1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 | function bp_groups_admin_edit_metabox_members( $item ) { // Pull up a list of group members, so we can separate out the types // We'll also keep track of group members here to place them into a // JavaScript variable, which will help with group member autocomplete. $members = array ( 'admin' => array (), 'mod' => array (), 'member' => array (), 'banned' => array (), ); $pagination = array ( 'admin' => array (), 'mod' => array (), 'member' => array (), 'banned' => array (), ); foreach ( $members as $type => & $member_type_users ) { $page_qs_key = $type . '_page' ; $current_type_page = isset( $_GET [ $page_qs_key ] ) ? absint( $_GET [ $page_qs_key ] ) : 1; $member_type_query = new BP_Group_Member_Query( array ( 'group_id' => $item ->id, 'group_role' => array ( $type ), 'type' => 'alphabetical' , /** * Filters the admin members type per page value. * * @since BuddyPress 2.8.0 * * @param int $value profile types per page. Default 10. * @param string $type profile type. */ 'per_page' => apply_filters( 'bp_groups_admin_members_type_per_page' , 10, $type ), 'page' => $current_type_page , ) ); $member_type_users = $member_type_query ->results; $pagination [ $type ] = bp_groups_admin_create_pagination_links( $member_type_query , $type ); } // Echo out the JavaScript variable. echo '<script>var group_id = "' . esc_js( $item ->id ) . '";</script>' ; // Loop through each profile type. foreach ( $members as $member_type => $type_users ) : ?> <div class = "bp-groups-member-type" id= "bp-groups-member-type-<?php echo esc_attr( $member_type ) ?>" > <h3><?php switch ( $member_type ) : case 'admin' : esc_html_e( 'Organizers' , 'buddyboss' ); break ; case 'mod' : esc_html_e( 'Moderators' , 'buddyboss' ); break ; case 'member' : esc_html_e( 'Members' , 'buddyboss' ); break ; case 'banned' : esc_html_e( 'Banned Members' , 'buddyboss' ); break ; endswitch ; ?></h3> <div class = "bp-group-admin-pagination table-top" > <?php echo $pagination [ $member_type ] ?> </div> <?php if ( ! empty ( $type_users ) ) : ?> <table class = "widefat bp-group-members" > <thead> <tr> <th scope= "col" class = "uid-column" ><?php _e( 'ID' , 'buddyboss' ); ?></th> <th scope= "col" class = "uname-column" ><?php _e( 'Name' , 'buddyboss' ); ?></th> <th scope= "col" class = "urole-column" ><?php _e( 'Role' , 'buddyboss' ); ?></th> </tr> </thead> <tbody> <?php foreach ( $type_users as $type_user ) : ?> <tr> <th scope= "row" class = "uid-column" ><?php echo esc_html( $type_user ->ID ); ?></th> <td class = "uname-column" > <a style= "float: left;" href= "<?php echo bp_core_get_user_domain( $type_user->ID ); ?>" ><?php echo bp_core_fetch_avatar( array ( 'item_id' => $type_user ->ID, 'width' => '32' , 'height' => '32' ) ); ?></a> <span style= "margin: 8px; float: left;" ><?php echo bp_core_get_userlink( $type_user ->ID ); ?></span> </td> <td class = "urole-column" > <label for = "bp-groups-role-<?php echo esc_attr( $type_user->ID ); ?>" class = "screen-reader-text" ><?php /* translators: accessibility text */ _e( 'Select group role for member' , 'buddyboss' ); ?></label> <select class = "bp-groups-role" id= "bp-groups-role-<?php echo esc_attr( $type_user->ID ); ?>" name= "bp-groups-role[<?php echo esc_attr( $type_user->ID ); ?>]" > <optgroup label= "<?php esc_attr_e( 'Roles', 'buddyboss' ); ?>" > <option class = "admin" value= "admin" <?php selected( 'admin' , $member_type ); ?>><?php esc_html_e( 'Organizer' , 'buddyboss' ); ?></option> <option class = "mod" value= "mod" <?php selected( 'mod' , $member_type ); ?>><?php esc_html_e( 'Moderator' , 'buddyboss' ); ?></option> <option class = "member" value= "member" <?php selected( 'member' , $member_type ); ?>><?php esc_html_e( 'Member' , 'buddyboss' ); ?></option> <?php if ( 'banned' === $member_type ) : ?> <option class = "banned" value= "banned" <?php selected( 'banned' , $member_type ); ?>><?php esc_html_e( 'Banned' , 'buddyboss' ); ?></option> <?php endif ; ?> </optgroup> <optgroup label= "<?php esc_attr_e( 'Actions', 'buddyboss' ); ?>" > <option class = "remove" value= "remove" ><?php esc_html_e( 'Remove' , 'buddyboss' ); ?></option> <?php if ( 'banned' !== $member_type ) : ?> <option class = "banned" value= "banned" ><?php esc_html_e( 'Ban' , 'buddyboss' ); ?></option> <?php endif ; ?> </optgroup> </select> <?php /** * Store the current role for this user, * so we can easily detect changes. * * @todo remove this, and do database detection on save */ ?> <input type= "hidden" name= "bp-groups-existing-role[<?php echo esc_attr( $type_user->ID ); ?>]" value= "<?php echo esc_attr( $member_type ); ?>" /> </td> </tr> <?php if ( has_filter( 'bp_groups_admin_manage_member_row' ) ) : ?> <tr> <td colspan= "3" > <?php /** * Fires after the listing of a single row for members in a group on the group edit screen. * * @since BuddyPress 1.8.0 * * @param int $ID ID of the user being rendered. * @param BP_Groups_Group $item Object for the current group. */ do_action( 'bp_groups_admin_manage_member_row' , $type_user ->ID, $item ); ?> </td> </tr> <?php endif ; ?> <?php endforeach ; ?> </tbody> </table> <?php else : ?> <p class = "bp-groups-no-members description" ><?php esc_html_e( 'No members of this type' , 'buddyboss' ); ?></p> <?php endif ; ?> </div><!-- .bp-groups-member-type --> <?php endforeach ; } |
Changelog
Version | Description |
---|---|
BuddyPress 1.7.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.