BP_Blogs_Blog::delete_blog_for_user( int $blog_id, int|null $user_id = null )

Delete the record of a given blog for a specific user.


Parameters Parameters

$blog_id

(int) (Required) The blog being removed.

$user_id

(int|null) (Optional) The ID of the user from whom the blog is being removed. If absent, defaults to the logged-in user ID.

Default value: null


Top ↑

Return Return

(int|bool) Number of rows deleted on success, false on failure.


Source Source

File: bp-blogs/classes/class-bp-blogs-blog.php

	public static function delete_blog_for_user( $blog_id, $user_id = null ) {
		global $wpdb;

		if ( !$user_id )
			$user_id = bp_loggedin_user_id();

		$bp = buddypress();

		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name} WHERE user_id = %d AND blog_id = %d", $user_id, $blog_id ) );
	}


Top ↑

User Contributed Notes User Contributed Notes

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