bp_blogs_remove_post

Remove a blog post activity item from the activity stream.

Description

bp_blogs_remove_post( (int) $post_id, (int) $blog_id = 0, (int) $user_id = 0 ); 

Parameters (3)

0. $post_id (int)
ID of the post to be removed.
1. $blog_id — Optional. (int)
Defaults to current blog ID.
2. $user_id — Optional. (int)
Defaults to the logged-in user ID. This param is currently unused in the function (but is passed to hooks).

Usage

  1. if ( !function_exists( 'bp_blogs_remove_post' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-activity.php'; 
  3.  
  4. // ID of the post to be removed. 
  5. $post_id = -1; 
  6.  
  7. // Optional. Defaults to current blog ID. 
  8. $blog_id = -1; 
  9.  
  10. // Optional. Defaults to the logged-in user ID. This param 
  11. // is currently unused in the function (but is passed to hooks). 
  12. $user_id = -1; 
  13.  
  14. // NOTICE! Understand what this does before running. 
  15. $result = bp_blogs_remove_post($post_id, $blog_id, $user_id); 
  16.  

Defined (1)

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

/bp-blogs/bp-blogs-activity.php  
  1. function bp_blogs_remove_post( $post_id, $blog_id = 0, $user_id = 0 ) { 
  2. global $wpdb; 
  3.  
  4. if ( empty( $wpdb->blogid ) ) { 
  5. return false; 
  6.  
  7. $post_id = (int) $post_id; 
  8.  
  9. if ( ! $blog_id ) { 
  10. $blog_id = (int) $wpdb->blogid; 
  11.  
  12. if ( ! $user_id ) { 
  13. $user_id = bp_loggedin_user_id(); 
  14.  
  15. /** 
  16. * Fires before removal of a blog post activity item from the activity stream. 
  17. * @since 1.5.0 
  18. * @param int $blog_id ID of the blog associated with the post that was removed. 
  19. * @param int $post_id ID of the post that was removed. 
  20. * @param int $user_id ID of the user having the blog removed for. 
  21. */ 
  22. do_action( 'bp_blogs_before_remove_post', $blog_id, $post_id, $user_id ); 
  23.  
  24. 'item_id' => $blog_id,  
  25. 'secondary_item_id' => $post_id,  
  26. 'component' =>buddypress)->blogs->id,  
  27. 'type' => 'new_blog_post' 
  28. ) ); 
  29.  
  30. /** 
  31. * Fires after removal of a blog post activity item from the activity stream. 
  32. * @since 1.0.0 
  33. * @param int $blog_id ID of the blog associated with the post that was removed. 
  34. * @param int $post_id ID of the post that was removed. 
  35. * @param int $user_id ID of the user having the blog removed for. 
  36. */ 
  37. do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $user_id );