bbp_remove_user_engagement( int $user_id, int $topic_id )

Remove a topic from user’s engagements


Description Description


Parameters Parameters

$user_id

(Optional) User id

$topic_id

(Optional) Topic id


Top ↑

Return Return

(bool) True if the topic was removed from user's engagements, otherwise false


Top ↑

Source Source

File: includes/users/engagements.php

function bbp_remove_user_engagement( $user_id = 0, $topic_id = 0 ) {

	// Bail if not enough info
	if ( empty( $user_id ) || empty( $topic_id ) ) {
		return false;
	}

	// Bail if not already engaged
	if ( ! bbp_is_user_engaged( $user_id, $topic_id ) ) {
		return false;
	}

	// Bail if remove fails
	if ( ! bbp_remove_user_from_object( $topic_id, $user_id, '_bbp_engagement' ) ) {
		return false;
	}

	do_action( 'bbp_remove_user_engagement', $user_id, $topic_id );

	return true;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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