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 '<span class="category">Members</span>'; while($row = mysqli_fetch_array($result_m,MYSQLI_ASSOC)){ if(strlen($row) > 35) { $row = substr($row, 0, 35) . "..."; } echo '<span class="searchheading"><a href="'.$row.'">'.$row.'</a></span>'; 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!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Impossible to get avatars in a custom AJAX search?’ is closed to new replies.