BP_Groups_Member::__construct( int $user_id, int $group_id, int|bool $id = false, bool $populate = true )

Constructor method.

Description

Parameters

$user_id

(int) (Optional) Along with $group_id, can be used to look up a membership.

$group_id

(int) (Optional) Along with $user_id, can be used to look up a membership.

$id

(int|bool) (Optional) The unique ID of the membership object.

Default value: false

$populate

(bool) (Optional) Whether to populate the properties of the located membership. Default: true.

Default value: true

Source

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

	public function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) {

		// User and group are not empty, and ID is.
		if ( !empty( $user_id ) && !empty( $group_id ) && empty( $id ) ) {
			$this->user_id  = $user_id;
			$this->group_id = $group_id;

			if ( !empty( $populate ) ) {
				$this->populate();
			}
		}

		// ID is not empty.
		if ( !empty( $id ) ) {
			$this->id = $id;

			if ( !empty( $populate ) ) {
				$this->populate();
			}
		}
	}

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.