Any ideas if anything changed in D10? This hook doesn't seem to get triggered adding content in group.
- πΊπΈUnited States dureaghin Albany, NY
Drupal 10 version:
function hook_group_relationship_update(GroupRelationshipInterface $entity) { // Act only on specific Group type memberships. if ($entity->bundle() == 'GROUP_TYPE-group_membership') { $new = array_column($entity->group_roles->getValue(), 'target_id'); $old = array_column($entity->original->group_roles->getValue(), 'target_id'); sort($new); sort($old); // If roles changed. if ($new != $old) { // Act on the role change here. \Drupal::messenger()->addMessage('Act on the role change here'); } } }