bbp_remove_user_subscription

Remove a topic from user's subscriptions.

Description

bbp_remove_user_subscription( (int) $user_id = 0, (int) $object_id = 0 ); 

Parameters (2)

0. $user_id — Optional. (int)
User id
1. $object_id — Optional. (int)
Topic id

Usage

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

Defined (1)

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

/includes/users/functions.php  
  1. function bbp_remove_user_subscription( $user_id = 0, $object_id = 0 ) { 
  2. if ( empty( $user_id ) || empty( $object_id ) ) { 
  3. return false; 
  4.  
  5. $post_type = get_post_type( $object_id ); 
  6. if ( empty( $post_type ) ) { 
  7. return false; 
  8.  
  9. switch( $post_type ) { 
  10.  
  11. // Forum 
  12. bbp_remove_user_forum_subscription( $user_id, $object_id ); 
  13. break; 
  14.  
  15. // Topic 
  16. default : 
  17. bbp_remove_user_topic_subscription( $user_id, $object_id ); 
  18. break; 
  19.  
  20. do_action( 'bbp_remove_user_subscription', $user_id, $object_id, $post_type ); 
  21.  
  22. return true;