bp_groups_get_invited_by( int $user_id = false, int $group_id = false )

Get inviter for member’s group invitation

Description

Parameters

$user_id

(Optional) ID of the user.

Default value: false

$group_id

(Optional) ID of the group.

Default value: false

Return

(array)

Source

File: bp-groups/bp-groups-functions.php

function bp_groups_get_invited_by( $user_id = false, $group_id = false ) {
	global $groups_template;

	if ( empty( $user_id ) && bp_displayed_user_id() ) {
		$user_id = bp_displayed_user_id();
	}

	if ( empty( $group_id ) ) {
		$group =& $groups_template->group;
	} else {
		$group = groups_get_group( $group_id );
	}

	if ( empty( $user_id ) || empty( $group ) ) {
		return false;
	}

	$member = new BP_Groups_Member( $user_id, $group->id );

	$inviter = array(
		'id'   => $member->inviter_id,
		'name' => bp_core_get_user_displayname( $member->inviter_id ),
		'url'  => bp_core_get_user_domain( $member->inviter_id ),
	);

	return apply_filters( 'bp_groups_get_invited_by', $inviter, $group->id );
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.