BP_Friends_Friendship::get_friendship_ids_for_user( int $user_id )

Get all friendship IDs for a user.

Description

Parameters

$user_id

(int) (Required) ID of the user.

Return

(array)

Source

File: bp-friends/classes/class-bp-friends-friendship.php

	public static function get_friendship_ids_for_user( $user_id ) {
		global $wpdb;

		$bp = buddypress();

		$friendship_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d OR friend_user_id = %d) ORDER BY date_created DESC", $user_id, $user_id ) );

		return $friendship_ids;
	}

Changelog

Changelog
Version Description
BuddyPress 2.7.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.