bp_blogs_remove_post( int $post_id, int $blog_id, int $user_id )
Remove a blog post activity item from the activity feed.
Description
Parameters
- $post_id
-
(Required) ID of the post to be removed.
- $blog_id
-
(Optional) Defaults to current blog ID.
- $user_id
-
(Optional) Defaults to the logged-in user ID. This param is currently unused in the function (but is passed to hooks).
Return
(bool)
Source
File: bp-blogs/bp-blogs-activity.php
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | function bp_blogs_remove_post( $post_id , $blog_id = 0, $user_id = 0 ) { global $wpdb ; if ( empty ( $wpdb ->blogid ) ) { return false; } $post_id = (int) $post_id ; if ( ! $blog_id ) { $blog_id = (int) $wpdb ->blogid; } if ( ! $user_id ) { $user_id = bp_loggedin_user_id(); } /** * Fires before removal of a blog post activity item from the activity feed. * * @since BuddyPress 1.5.0 * * @param int $blog_id ID of the blog associated with the post that was removed. * @param int $post_id ID of the post that was removed. * @param int $user_id ID of the user having the blog removed for. */ do_action( 'bp_blogs_before_remove_post' , $blog_id , $post_id , $user_id ); bp_blogs_delete_activity( array ( 'item_id' => $blog_id , 'secondary_item_id' => $post_id , 'component' => buddypress()->blogs->id, 'type' => 'new_blog_post' ) ); /** * Fires after removal of a blog post activity item from the activity feed. * * @since BuddyPress 1.0.0 * * @param int $blog_id ID of the blog associated with the post that was removed. * @param int $post_id ID of the post that was removed. * @param int $user_id ID of the user having the blog removed for. */ do_action( 'bp_blogs_remove_post' , $blog_id , $post_id , $user_id ); } |
Changelog
Version | Description |
---|---|
BuddyPress 1.0.0 | 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.