Impossible to get avatars in a custom AJAX search?
-
Hi,
I’m running BP 1.2.8 on WP 3.1 and I’ve created an AJAX/jQuery live search that’s a lot like Facebook’s. It works fine — however, no matter what I try, it seems to break every time I try to add avatars to the search results.
Here’s the code I’m trying:
`
$query_m = “SELECT ID, user_url, display_name FROM {$wpdb->prefix}_users WHERE display_name LIKE ‘%$keyword%’ ORDER BY ID LIMIT 8″;
$result_m = mysqli_query($dbc,$query_m);
if($result_m){
if(mysqli_affected_rows($dbc)!=0){echo ‘Members‘;
while($row = mysqli_fetch_array($result_m,MYSQLI_ASSOC)){
if(strlen($row) > 35) {
$row = substr($row, 0, 35) . “…”;
}echo ‘‘.$row.’‘;
echo bp_core_fetch_avatar(‘item_id=’.$row );
}
}else {
echo ‘No Results for :”‘.$_GET.’” in Members
‘;
}}
`I’ve also tried calling the $bp global right before bp_core_fetch_avatar, but it doesn’t seem to make a difference.
Any help would be greatly appreciated!
You must be logged in to reply to this topic.