Example #1
0
             // restore hidden settings
             access_show_hidden_entities($hidden);
         }
         system_message(elgg_echo('group_tools:action:fix_acl:success:without', [count($groups)]));
     } else {
         register_error(elgg_echo('group_tools:action:fix_acl:error:without:nothing'));
     }
     break;
 case 'all':
     // fix all problems
     // first: groups without acl
     $groups = group_tools_get_groups_without_acl();
     if (!empty($groups)) {
         // create the acl's for each group
         foreach ($groups as $group) {
             groups_create_event_listener('create', 'group', $group);
         }
         system_message(elgg_echo('group_tools:action:fix_acl:success:without', [count($groups)]));
     }
     // now add the group members
     $missing_users = group_tools_get_missing_acl_users();
     if (!empty($missing_users)) {
         // make sure we can see all users
         $hidden = access_get_show_hidden_status();
         access_show_hidden_entities(true);
         foreach ($missing_users as $user_data) {
             /**
              * $user_data = row stdClass
              * 		-> acl_id 		=> the acl the user should be added to
              * 		-> group_guid 	=> the group the acl belongs to
              * 		-> user_guid 	=> the user that should be added
Example #2
0
             }
             // restore hidden settings
             access_show_hidden_entities($hidden);
         }
         system_message(elgg_echo("group_tools:action:fix_acl:success:without", array(count($groups))));
     } else {
         register_error(elgg_echo("group_tools:action:fix_acl:error:without:nothing"));
     }
     break;
 case "all":
     // fix all problems
     // first: groups without acl
     if ($groups = group_tools_get_groups_without_acl()) {
         // create the acl's for each group
         foreach ($groups as $group) {
             groups_create_event_listener("create", "group", $group);
         }
         system_message(elgg_echo("group_tools:action:fix_acl:success:without", array(count($groups))));
     }
     // now add the group members
     if ($missing_users = group_tools_get_missing_acl_users()) {
         // make sure we can see all users
         $hidden = access_get_show_hidden_status();
         access_show_hidden_entities(true);
         foreach ($missing_users as $user_data) {
             /**
              * $user_data = row stdClass
              * 		-> acl_id 		=> the acl the user should be added to
              * 		-> group_guid 	=> the group the acl belongs to
              * 		-> user_guid 	=> the user that should be added
              */