bbp_get_user_topic_subscriptions( int $user_id )
Get a user’s subscribed topics
Description
Parameters
- $user_id
-
(Optional) User id
Return
(array|bool) Results if user has subscriptions, otherwise false
Source
File: bp-forums/users/functions.php
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | function bbp_get_user_topic_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_topic_ids( $user_id ); if ( ! empty ( $subscriptions ) ) { $query = bbp_has_topics( array ( 'post__in' => $subscriptions ) ); } else { $query = false; } return apply_filters( 'bbp_get_user_topic_subscriptions' , $query , $user_id ); } |
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.