Display Name in Group Member Search — is there a functions.php equiv. in admin?
-
I’ve searched for the past several hours and couldn’t find an answer to this… if someone already answered this, I apologize for repeating.
I have a client who is developing a BP member area for nonprofit partners around the world. On the groups administration screen ( Dashboard –> Groups –> Edit –> Add new members ), they would like to change the display from “User name” and “user email” to “Display name” and “user email.”
On line 946 of bp-groups-admin (content/plugins/buddypress/bp-groups/bp-groups-admin) I found
/**
* AJAX handler for group member autocomplete requests
*
* @since BuddyPress (1.7)
*/
function bp_groups_admin_autocomplete_handler() {// Bail if user user shouldn’t be here, or is a large network
if ( ! current_user_can( ‘bp_moderate’ ) || ( is_multisite() && wp_is_large_network( ‘users’ ) ) )
wp_die( -1 );$return = array();
// Exclude current group members
$group_id = isset( $_GET[‘group_id’] ) ? wp_parse_id_list( $_GET[‘group_id’] ) : array();
$group_member_query = new BP_Group_Member_Query( array(
‘group_id’ => $group_id,
‘per_page’ => 0, // show all
‘group_role’ => array( ‘member’, ‘mod’, ‘admin’, ),
‘populate_extras’ => false,
‘count_total’ => false,
) );$group_members = ! empty( $group_member_query->results ) ? wp_list_pluck( $group_member_query->results, ‘ID’ ) : array();
$terms = isset( $_GET[‘term’] ) ? $_GET[‘term’] : ”;
$users = get_users( array(
‘blog_id’ => false,
‘search’ => ‘*’ . $terms . ‘*’,
‘exclude’ => $group_members,
‘search_columns’ => array( ‘user_login’, ‘user_nicename’, ‘user_email’, ‘display_name’ ),
‘number’ => 10
) );foreach ( (array) $users as $user ) {
$return[] = array(
/* translators: 1: user_login, 2: user_email */
‘label’ => sprintf( __( ‘%1$s (%2$s)’ ), $user->user_login, $user->user_email ),
‘value’ => $user->user_login,
);
}On that very last “foreach” I think I want to change ‘label’ => sprintf( __( ‘%1$s (%2$s)’ ), $user->user_login, $user->user_email ) to reference display_name instead of email
Can anyone confirm if this is true? Also, is there a template hierarchy that would allow me to load a modified php script in place of this one, or perhaps something like a child theme functions.php where I could unhook that function and attach my modified one?
I apologize if this is an obvious thing… spent several hours and could not find an answer. Need some help from folks who know more about BP than I do. I appreciate your time in advance. For reals.
- The topic ‘Display Name in Group Member Search — is there a functions.php equiv. in admin?’ is closed to new replies.