bbp_remove_user_subscription( int $user_id,  $object_id )

Remove a topic from user’s subscriptions

Description

Parameters

$user_id

(Optional) User id

$topic_id

(Optional) Topic id

Return

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

Source

File: bp-forums/users/functions.php

function bbp_remove_user_subscription( $user_id = 0, $object_id = 0 ) {
	if ( empty( $user_id ) || empty( $object_id ) ) {
		return false;
	}

	$post_type = get_post_type( $object_id );
	if ( empty( $post_type ) ) {
		return false;
	}

	switch( $post_type ) {

		// Forum
		case bbp_get_forum_post_type() :
			bbp_remove_user_forum_subscription( $user_id, $object_id );
			break;

		// Topic
		case bbp_get_topic_post_type() :
		default :
			bbp_remove_user_topic_subscription( $user_id, $object_id );
			break;
	}

	do_action( 'bbp_remove_user_subscription', $user_id, $object_id, $post_type );

	return true;
}

Changelog

Changelog
Version Description
bbPress (r2668) 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.