bbp_get_user_subscribed_topic_ids

Get a user's subscribed topics' ids.

Description

(array|bool) bbp_get_user_subscribed_topic_ids( (int) $user_id = 0 ); 

Returns (array|bool)

Results if user has subscriptions, otherwise false

Parameters (1)

0. $user_id — Optional. (int)
User id

Usage

  1. if ( !function_exists( 'bbp_get_user_subscribed_topic_ids' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/users/functions.php'; 
  3.  
  4. // Optional. User id 
  5. $user_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_user_subscribed_topic_ids($user_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/users/functions.php  
  1. function bbp_get_user_subscribed_topic_ids( $user_id = 0 ) { 
  2. $user_id = bbp_get_user_id( $user_id ); 
  3. if ( empty( $user_id ) ) 
  4. return false; 
  5.  
  6. $subscriptions = get_user_option( '_bbp_subscriptions', $user_id ); 
  7. $subscriptions = array_filter( wp_parse_id_list( $subscriptions ) ); 
  8.  
  9. return (array) apply_filters( 'bbp_get_user_subscribed_topic_ids', $subscriptions, $user_id );