Add/Remove group role for a user programmatically

Created on 29 April 2020, over 4 years ago
Updated 19 March 2024, 8 months ago

Problem/Motivation

Currently, there is only the function addMember(UserInterface $account, $values = []) for adding roles to a user in a group.
A need for adding or removing a group role is needed as its own function.
This is also stated in one of the test classes in the module

// @todo This displays a desperate need for addRole() and removeRole().
    $membership = $member->getGroupContent();
    $membership->group_roles[] = 'default-custom';
    $membership->save();

Proposed resolution

Add 2 new functions for adding or removing a group role.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Fixed

Version

3.3

Component

Code

Created by

πŸ‡¨πŸ‡­Switzerland Ginovski Bern

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024