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

Check whether a user is banned from a given group.


Parameters Parameters

$user_id

(int) (Required) ID of the user.

$group_id

(int) (Required) ID of the group.


Top ↑

Return 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 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;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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