Skip to:
Content

BuddyPress.org

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2424 closed defect (bug) (fixed)

wrong group member sql query in BP_Groups_Member::get_all_for_group

Reported by: smurfdev's profile smurfdev Owned by:
Milestone: 1.5 Priority: normal
Severity: Version:
Component: Groups Keywords:
Cc:

Description

1/ if xprofile is enabled but no field defined no member will be displayed in the group member list ( /groups/group-name/members/ )

2/ if xprofile is enabled with one field defined, let's say 'town', member list will be displayed as the list of group members' towns.

I suggest replacing lines in bp-groups/bp-groups-classes.php :

889 if ( bp_is_active( 'xprofile' ) )
890 $members = $wpdb->get_results( apply_filters( 'bp_group_members_user_join_filter', $wpdb->prepare( "SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, pd.value as display_name FROM {$bp->groups->table_name_members} m, {$wpdb->users} u, {$bp->profile->table_name_data} pd WHERE u.ID = m.user_id AND u.ID = pd.user_id AND pd.field_id = 1 AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} ORDER BY m.date_modified DESC {$pag_sql}", $group_id ) ) );
891 else
892 $members = $wpdb->get_results( apply_filters( 'bp_group_members_user_join_filter', $wpdb->prepare( "SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$bp->groups->table_name_members} m, {$wpdb->users} u WHERE u.ID = m.user_id AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} ORDER BY m.date_modified DESC {$pag_sql}", $group_id ) ) );

with :

$members = $wpdb->get_results( $wpdb->prepare( "SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, if(u.display_name=,u.user_nicename,u.display_name) as display_name FROM {$bp->groups->table_name_members} m, {$wpdb->users} u WHERE u.ID = m.user_id AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} ORDER BY m.date_modified DESC {$pag_sql}", $group_id ) );

Change History (4)

#1 @smurfdev
14 years ago

  • Component changed from Core to Groups

#2 @johnjamesjacoby
14 years ago

  • Milestone changed from 1.2.5 to 1.3

I'm going to bump this to 1.3 because you shouldn't have a situation where XProfile doesn't have a primary field and field group available.

If that's what you've experienced, then that's probably the real culprit to this.

#3 @johnjamesjacoby
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [3058]) Fix #2424

#4 @johnjamesjacoby
14 years ago

After a little review, that's what happened. Fixed yo!

Note: See TracTickets for help on using tickets.