Re: using friends_check_friendship
I’m not sure in what context the function is being called. You are saying this works in bp for you but not outside of bp? The call might be failing because the bp globals might not be fired up. bp’s plugins get loaded but bp relies on the ‘wp’ action to init the $bp global object which has all the table names and other goodies bp needs to operate.
You are making the fn call from inside query.php inside of a wp theme context? Is this from an ajax context? If it’s ajax then bp doesn’t have any plugins loaded or global vars instantiated.
Try doing this in an ajax context:
wp-load.php like you are then
See Andy’s /bp-core/bp-core-ajax-handler.php for how he does this.