Skip to:
Content

BuddyPress.org

Opened 5 months ago

Last modified 4 months ago

#8292 new defect (bug)

Multiple member types users table issue

Reported by: etatus Owned by:
Milestone: 7.0.0 Priority: normal
Severity: major Version: 5.2.0
Component: Members Keywords:
Cc: etatus

Description

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.

Change History (2)

#1 @imath
4 months ago

  • Milestone changed from Awaiting Review to 7.0.0

Thanks for your feedback. I guess we also need to make it possible to select more than one member type into the WP-Admin/Extended Profile's metabox.

#2 @etatus
4 months ago

  • Cc etatus added

Yes, definitely it's a good idea to allow selecting more than one member type as multiple member types support is a core feature.

Last edited 4 months ago by etatus (previous) (diff)
Note: See TracTickets for help on using tickets.