bbp_get_user_forum_subscriptions( int $user_id )

Get a user’s subscribed forums

Description

Parameters

$user_id

(Optional) User id

Return

(array|bool) Results if user has subscriptions, otherwise false

Source

File: bp-forums/users/functions.php

function bbp_get_user_forum_subscriptions( $user_id = 0 ) {

	// Default to the displayed user
	$user_id = bbp_get_user_id( $user_id );
	if ( empty( $user_id ) ) {
		return false;
	}

	// If user has subscriptions, load them
	$subscriptions = bbp_get_user_subscribed_forum_ids( $user_id );
	if ( !empty( $subscriptions ) ) {
		$query = bbp_has_forums( array( 'post__in' => $subscriptions ) );
	} else {
		$query = false;
	}

	return apply_filters( 'bbp_get_user_forum_subscriptions', $query, $user_id );
}

Changelog

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