SyncGenerator::addUserToBpGroup( $userId, $type, $remove )
Add a user to bp group by role
Description
Source
File: bp-integrations/learndash/library/SyncGenerator.php
protected function addUserToBpGroup($userId, $type, $remove)
{
$groupMember = new BP_Groups_Member($userId, $this->bpGroupId);
$syncTo = $this->getLdSyncToRole($type);
if ($remove) {
return $groupMember->remove();
}
$groupMember->group_id = $this->bpGroupId;
$groupMember->user_id = $userId;
$groupMember->is_admin = 0;
$groupMember->is_mod = 0;
$groupMember->is_confirmed = 1;
if ('user' != $syncTo) {
$var = "is_{$syncTo}";
$groupMember->$var = 1;
}
$groupMember->save();
}
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.