in group_tools plugin, is group_admin a relationship comes with default elgg?

In the group_tools plugin, with the mulitple admins enabled, the group owner can assign group admin rights to other users. I looked at the code and found it'a achieved by 

add_entity_relationship($user->getGUID(), 'group_admin', $group->getGUID())

 is group_admin a relationship comes with default elgg? or we need to define it? Couldn't find it in the plugin, but also couldn't find the relationship definition in elgg. Tried to google, but comes out too many 404s. 

  • I am trying to replicate this multi admin functionality in my theme, but to use the whole plugin, it will create too much overhead, so I have to 'steal' some code from the group_tools plugin. 

    I have registered the entity menu and user_hover menu, registered the toggle_admin action and extend the site.js in start.php;

    I have copied the assignGroupAdmin function and added the toggle_admin action. 

    When I click 'add group admin', I can see the success flash message and the entity menu also been changed to 'remove group admin', but when I logged in as that group admin user, it's not working! The user doesn't have the group admin access like edit group. 

    What did I miss?

  • Hi Eskimo,

    the group_admin relationship is not something from core. Group Tools adds the relationship. It also takes care of the extra rights via access related hooks. Maybe your copywork contains the creation of the relationship, but does not provide the extra access/rights that this role should give group admins.

    Kind regards


  • Hi Jeroen,

    Thank you for your reply. You are absolutely right. If the group_admin relationship is not from core, then I must have missed the 'extra access/rights' part. I tried to find these related hooks as you suggested, but only find these lines of code in start.php:

    elgg_register_plugin_hook_handler('default', 'access', '\ColdTrick\GroupTools\Access::setGroupDefaultAccess');
        elgg_register_plugin_hook_handler('default', 'access', '\ColdTrick\GroupTools\Access::validateGroupDefaultAccess', 999999);
        elgg_register_plugin_hook_handler('access:collections:write', 'user', '\ColdTrick\GroupTools\Access::defaultAccessOptions');

    but none of them seems to be related to the group_admin's rights. Do you mind telling me what hooks should I look at regarding the extra rights of group_admin? Thanks.

  • found it. It's this permissions_check hook handler:

    elgg_register_plugin_hook_handler('permissions_check', 'group', 'permissions_check');