You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.
How to automatically set the ADMINISTRATOR option for the creator of a group?
I've tried to modify the function og_entity_insert(EntityInterface $entity) as follows:
if (!Og::getMembership($entity, $entity->getOwner(), OgMembershipInterface::ALL_STATES)) { $membership = Og::createMembership($entity, $entity->getOwner()); // Get the roles $roles = $membership->getRoles(); foreach ($roles as $rid) { $role = Role::load($rid); if (!$role->isAdmin()) { $role->setIsAdmin(TRUE); } $role->save(); } $membership->setRoles($roles); $membership->save();
But without success. The roles can't be converted to string ...
I'm not a developer. So I do not really understand, what happens and I'm not able to figure out, where the ADMINISTATOR option is added to the members profile and how to activate it.
In my configuration a possibility to activate this option manually is not preset for normal registered users. So if one creates a group, it should automatically be activated, in the meaning, that the group creator is automatically the group administrator.
Version: 8.x-1.0-alpha7, Drupal 9
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
How to automatically set the ADMINISTRATOR option for the creator of a group?
I've tried to modify the function og_entity_insert(EntityInterface $entity) as follows:
if (!Og::getMembership($entity, $entity->getOwner(), OgMembershipInterface::ALL_STATES)) { $membership = Og::createMembership($entity, $entity->getOwner()); // Get the roles $roles = $membership->getRoles(); foreach ($roles as $rid) { $role = Role::load($rid); if (!$role->isAdmin()) { $role->setIsAdmin(TRUE); } $role->save(); } $membership->setRoles($roles); $membership->save();
But without success. The roles can't be converted to string ...
I'm not a developer. So I do not really understand, what happens and I'm not able to figure out, where the ADMINISTATOR option is added to the members profile and how to activate it.
In my configuration a possibility to activate this option manually is not preset for normal registered users. So if one creates a group, it should automatically be activated, in the meaning, that the group creator is automatically the group administrator.
Version: 8.x-1.0-alpha7, Drupal 9
The text was updated successfully, but these errors were encountered: