[buddypress-trac] [BuddyPress Trac] #8292: Multiple member types users table issue
buddypress-trac
noreply at wordpress.org
Wed May 6 14:31:44 UTC 2020
#8292: Multiple member types users table issue
--------------------------+-----------------------------
Reporter: etatus | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Members | Version: 5.2.0
Severity: major | Keywords:
--------------------------+-----------------------------
Hello, when a member has more than one member type, the users table in
admin view only shows one of them. To fix it I made the following
changes:
**buddypress/bp-members/classes/class-bp-members-admin.php**
Line 2369:
Change this:
{{{
// Get the member type.
$type = bp_get_member_type( $user_id );
// Output the
if ( $type_obj = bp_get_member_type_object( $type ) ) {
$url = add_query_arg( array( 'bp-member-type' => urlencode( $type
) ) );
$retval = '<a href="' . esc_url( $url ) . '">' . esc_html(
$type_obj->labels['singular_name'] ) . '</a>';
}
return $retval;
}}}
To this:
{{{
// Get the member types.
$types = bp_get_member_type( $user_id, false ); // Set to false to get
member types array insted only one type
foreach( $types as $type ) {
// Output the
if ( $type_obj = bp_get_member_type_object( $type ) ) {
$url = add_query_arg( array( 'bp-member-type' =>
urlencode( $type ) ) );
$retval .= '<a href="' . esc_url( $url ) . '">' .
esc_html( $type_obj->labels['singular_name'] ) . '</a>, ';
}
}
return rtrim( $retval, ', ' ); // Remove last comma
}}}
I hope this piece of code helps to fix the problem. I don't know if there
are other implications in other parts of code related to this issue.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8292>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list