BP_Blogs_Blog::delete_blogs_for_user( int|null $user_id = null )

Delete all of a user’s blog associations in the BP tables.

Description

Parameters

$user_id

(Optional) The ID of the user whose blog associations are being deleted. If absent, defaults to logged-in user ID.

Default value: null

Return

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

Source

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

	public static function delete_blogs_for_user( $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", $user_id ) );
	}

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.