bb_is_user_subscribed

Checks if user is subscribed to current topic.

Description

bb_is_user_subscribed( (null) $args = null ); 

Parameters (1)

0. $args — Optional. (null) => null
The args.

Usage

  1. if ( !function_exists( 'bb_is_user_subscribed' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php'; 
  3.  
  4. // The args. 
  5. $args = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_is_user_subscribed($args); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-template.php  
  1. function bb_is_user_subscribed( $args = null ) { 
  2. global $bbdb; 
  3.  
  4. $defaults = array( 
  5. ); 
  6. $args = wp_parse_args( $args, $defaults ); 
  7. extract( $args, EXTR_SKIP ); 
  8.  
  9. $there = $bbdb->get_var( $bbdb->prepare( "SELECT `$bbdb->term_relationships`.`object_id` 
  10. FROM $bbdb->term_relationships, $bbdb->term_taxonomy, $bbdb->terms 
  11. WHERE `$bbdb->term_relationships`.`object_id` = %d 
  12. AND `$bbdb->term_relationships`.`term_taxonomy_id` = `$bbdb->term_taxonomy`.`term_taxonomy_id` 
  13. AND `$bbdb->term_taxonomy`.`term_id` = `$bbdb->terms`.`term_id` 
  14. AND `$bbdb->term_taxonomy`.`taxonomy` = 'bb_subscribe' 
  15. AND `$bbdb->terms`.`slug` = 'topic-%d'",  
  16. $user_id, $topic_id ) ); 
  17.  
  18. $there = apply_filters( 'bb_is_user_subscribed', $there, $args ); 
  19.  
  20. if ( $there ) 
  21. return true; 
  22.  
  23. return false;