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

988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
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.