So I am using the WPMU Dev friends plugin which adds functionality for WP members to search for friends and to add new friends etc. There is a specific function defined in the PHP file which says it lets you check if users are friends. The code for this function is here:
/**
* Utility function to determine is a user is friends with another user.
*
* @since 1.2.3
*
* @param
* tmp_uid - int - Current user ID
* tmp_friend_uid - int - Friend user ID
* @return returns the value of 'friend_approved' field. 1 - Approved, 0 - Pending, null - no status
*/
function friends_check_status($tmp_uid, $tmp_friend_uid) {
global $wpdb;
$sql = $wpdb->prepare("SELECT friend_approved FROM " . $wpdb->base_prefix
. "friends WHERE user_ID = %d AND friend_user_ID = %d", $tmp_uid, $tmp_friend_uid);
//echo "sql=[". $sql ."]<br />";
return $wpdb->get_var($sql);
}
I would like to run this function to check against author_id
to check if the post author and user are friends if they are, I would the posts to be displayed but if not they should be hidden from the feed. Is this possible to do and does anyone have any ideas about how to go about it? Could I simply substitute tmp_friend_uid
for the_author_meta( 'ID' );
or something?