bp_nouveau_prepare_group_potential_invites_for_js( $user )
Prepare list of group invites for JS.
Description
Source
File: bp-templates/bp-nouveau/includes/groups/functions.php
function bp_nouveau_prepare_group_potential_invites_for_js( $user ) { $bp = buddypress(); $response = array( 'id' => intval( $user->ID ), 'name' => $user->display_name, 'avatar' => htmlspecialchars_decode( bp_core_fetch_avatar( array( 'item_id' => $user->ID, 'object' => 'user', 'type' => 'thumb', 'width' => 50, 'height' => 50, 'html' => false ) ) ), ); // Group id $group_id = bp_get_current_group_id()?: (int) $_REQUEST['group_id']; // Do extra queries only if needed if ( ! empty( $bp->groups->invites_scope ) && 'invited' === $bp->groups->invites_scope ) { $response['is_sent'] = (bool) groups_check_user_has_invite( $user->ID, $group_id ); $inviter_ids = bp_nouveau_groups_get_inviter_ids( $user->ID, $group_id ); foreach ( $inviter_ids as $inviter_id ) { $class = false; if ( bp_loggedin_user_id() === (int) $inviter_id ) { $class = 'group-self-inviter'; } $response['invited_by'][] = array( 'avatar' => htmlspecialchars_decode( bp_core_fetch_avatar( array( 'item_id' => $inviter_id, 'object' => 'user', 'type' => 'thumb', 'width' => 50, 'height' => 50, 'html' => false, 'class' => $class, ) ) ), 'user_link' => bp_core_get_userlink( $inviter_id, false, true ), 'user_name' => bp_core_get_username( $inviter_id ), ); } if ( bp_is_item_admin() ) { $response['can_edit'] = true; } else { $response['can_edit'] = in_array( bp_loggedin_user_id(), $inviter_ids ); } } /** * Filters the response value for potential group invite data for use with javascript. * * @since BuddyPress 3.0.0 * * @param array $response Array of invite data. * @param WP_User $user User object. */ return apply_filters( 'bp_nouveau_prepare_group_potential_invites_for_js', $response, $user ); }
Changelog
Version | Description |
---|---|
BuddyPress 3.0.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.