BP_Groups_Member::check_is_banned( int $user_id, int $group_id )

Check whether a user is banned from a given group.

Description

Parameters

$user_id

(int) (Required) ID of the user.

$group_id

(int) (Required) ID of the group.

Return

(int|null) int 1 if user is banned; int 0 if user is not banned; null if user is not part of the group or if group doesn't exist.

Source

File: bp-groups/classes/class-bp-groups-member.php

	public static function check_is_banned( $user_id, $group_id ) {
		global $wpdb;

		if ( empty( $user_id ) )
			return false;

		$bp = buddypress();

		$query = $wpdb->get_var( $wpdb->prepare( "SELECT is_banned FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );

		return is_numeric( $query ) ? (int) $query : $query;
	}

Changelog

Changelog
Version Description
BuddyPress 1.6.0 Introduced.

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.