BP_Friends_Friendship::get_friendship_ids_for_user( int $user_id )

Get all friendship IDs for a user.


Parameters Parameters

$user_id

(int) (Required) ID of the user.


Top ↑

Return Return

(array)


Source 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;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.