Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Member directory browsing issue.


David Bisset
Member

@dimensionmedia

I had a similar issue, and this is how i fixed it. Maybe it will help.

BTW, using WPMU 2.8.4a and BP 1.1.1.

bp-core-classes.php: around line 224:

$total_users_sql = apply_filters( ‘bp_core_users_by_letter_count_sql’, $wpdb->prepare( “SELECT DISTINCT count(u.ID) FROM ” . CUSTOM_USER_TABLE . ” u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE ‘$letter%%’ ORDER BY pd.value ASC”, BP_XPROFILE_FULLNAME_FIELD_NAME ), $letter );

$paged_users_sql = apply_filters( ‘bp_core_users_by_letter_sql’, $wpdb->prepare( “SELECT DISTINCT u.ID as user_id FROM ” . CUSTOM_USER_TABLE . ” u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE ‘$letter%%’ ORDER BY pd.value ASC{$pag_sql}”, BP_XPROFILE_FULLNAME_FIELD_NAME ), $letter, $pag_sql );

For me, it was the pf.name in the WHERE that was coming back with nothing. I understand the MYSQL, but not understanding the logic behind that. I changed it to what I was hoping to nail in the first place:

$total_users_sql = apply_filters( ‘bp_core_users_by_letter_count_sql’, $wpdb->prepare( “SELECT DISTINCT count(u.ID) FROM ” . CUSTOM_USER_TABLE . ” u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = ‘Last Name’ AND pd.value LIKE ‘$letter%%’ ORDER BY pd.value ASC”, BP_XPROFILE_FULLNAME_FIELD_NAME ), $letter );

$paged_users_sql = apply_filters( ‘bp_core_users_by_letter_sql’, $wpdb->prepare( “SELECT DISTINCT u.ID as user_id FROM ” . CUSTOM_USER_TABLE . ” u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = ‘Last Name’ AND pd.value LIKE ‘$letter%%’ ORDER BY pd.value ASC{$pag_sql}”, BP_XPROFILE_FULLNAME_FIELD_NAME ), $letter, $pag_sql );

Works fine for me. I’ve heard the latest edge version of BuddyPress fixes this somehow… but this worked at install for me so something must of changed. I have ALOT of custom profiles and the member import was a-typical so maybe in my case that had something to do with it.

Skip to toolbar