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.
Description
Parameters
- $blog_id
-
(Required) The blog being removed.
- $user_id
-
(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
Return
(int|bool) Number of rows deleted on success, false on failure.
Source
File: bp-blogs/classes/class-bp-blogs-blog.php
312 313 314 315 316 317 318 319 320 321 | 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 ) ); } |
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.