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

Constructor method.


Description Description


Parameters Parameters

$user_id

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

$group_id

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

$id

(Optional) The unique ID of the membership object.

Default value: false

$populate

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

Default value: true


Top ↑

Source 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();
			}
		}
	}

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.