BP_Friends_Friendship::withdraw( int $friendship_id )

Remove a connection or a connection request INITIATED BY the logged-in user.

Description

Parameters

$friendship_id

(Required) ID of the friendship to be withdrawn.

Return

(int) Number of database rows deleted.

Source

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

	public static function withdraw($friendship_id) {
		global $wpdb;

		$bp = buddypress();

		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND initiator_user_id = %d", $friendship_id, bp_loggedin_user_id() ) );
	}

Changelog

Changelog
Version Description
BuddyPress 1.6.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.