Friends::remove( $args )

Remove a friendship.


Description Description

Top ↑

OPTIONS OPTIONS

: ID of the friendship initiator. Accepts either a user_login or a numeric ID.
: ID of the friend user. Accepts either a user_login or a numeric ID.
## EXAMPLE
$ wp bp friend remove user1 another_user Success: Friendship successfully removed.


Source Source

File: cli/src/friends.php

	public function remove( $args ) {
		$initiator = $this->get_user_id_from_identifier( $args[0] );
		$friend    = $this->get_user_id_from_identifier( $args[1] );

		// Check if users are already friends, if not, bail.
		if ( ! friends_check_friendship( $initiator->ID, $friend->ID ) ) {
			WP_CLI::error( 'These users are not friends.' );
		}

		if ( friends_remove_friend( $initiator->ID, $friend->ID ) ) {
			WP_CLI::success( 'Friendship successfully removed.' );
		} else {
			WP_CLI::error( 'There was a problem while removing the friendship.' );
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

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