bp_blogs_remove_post( int $post_id, int $blog_id, int $user_id )

Remove a blog post activity item from the activity stream.


Parameters Parameters

$post_id

(int) (Required) ID of the post to be removed.

$blog_id

(int) (Optional) Defaults to current blog ID.

$user_id

(int) (Optional) Defaults to the logged-in user ID. This param is currently unused in the function (but is passed to hooks).


Top ↑

Return Return

(bool)


Source Source

File: bp-blogs/bp-blogs-activity.php

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 stream.
	 *
	 * @since 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 stream.
	 *
	 * @since 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 );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.