Why I cannot call bp_core_fetch_avatar in php with .post in wordpress and buddypress?

I am using wordpress and buddypress. When I using .post(), bp_core_get_user_domain,bp_core_fetch_avatar. those are not working. But if I put it in a regular .php file, everything is fine. What can I do if I need to call bp_core_get_user_domain,bp_core_fetch_avatar in my search.php file, and I want to use .post() or ajax function.

$('#tag').click(function(){
$.post("search.php", {
			search_id: $("#id_tag").text()
			},
			function(data)
			{
				$("#find_members").html(data);
			}
		);//$.post
  
  });
//it is the search.php
<?php
$member_id=$_POST['search_id'];

$user_link=bp_core_get_user_domain( $member_id );

$user_fetch_avatar=bp_core_fetch_avatar ( array( 'item_id' => $member_id, 'type' => 'thumb' ) ); 

$user_displayname=bp_core_get_user_displayname( $member_id );

$user_avatar=$user_fetch_avatar.$user_displayname;

echo $user_avatar;//testing to see if working or not

?>

Related posts

Leave a Reply