BP_Blogs_Blog::get_user_blog( int $user_id, int $blog_id )

Get ID of user-blog link.

Parameters Parameters


(int) (Required) ID of user.


(int) (Required) ID of blog.

Top ↑

Return Return

(int|bool) ID of user-blog link, or false if not found.

Source Source

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

	public static function get_user_blog( $user_id, $blog_id ) {
		global $wpdb;

		$bp = buddypress();

		$user_blog = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->blogs->table_name} WHERE user_id = %d AND blog_id = %d", $user_id, $blog_id ) );

		if ( empty( $user_blog ) ) {
			$user_blog = false;
		} else {
			$user_blog = intval( $user_blog );

		return $user_blog;

Top ↑

User Contributed Notes User Contributed Notes

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