if (count($tabs) > 1) { $navigation = elgg_view("navigation/tabs", array("tabs" => $tabs, "id" => "group-tools-special-states-tabs")); } echo elgg_view_module("inline", elgg_echo("group_tools:settings:special_states"), $navigation . $content); } // fix some problems with groups $rows = array(); // check missing acl members if ($missing_acl_members = group_tools_get_missing_acl_users()) { $rows[] = array(elgg_echo("group_tools:settings:fix:missing", array(count($missing_acl_members))), elgg_view("output/url", array("href" => "action/group_tools/fix_acl?fix=missing", "text" => elgg_echo("group_tools:settings:fix_it"), "class" => "elgg-button elgg-button-action", "is_action" => true, "style" => "white-space: nowrap;", "confirm" => true))); } // check excess acl members if ($excess_acl_members = group_tools_get_excess_acl_users()) { $rows[] = array(elgg_echo("group_tools:settings:fix:excess", array(count($excess_acl_members))), elgg_view("output/url", array("href" => "action/group_tools/fix_acl?fix=excess", "text" => elgg_echo("group_tools:settings:fix_it"), "class" => "elgg-button elgg-button-action", "is_action" => true, "style" => "white-space: nowrap;", "confirm" => true))); } // check groups without acl if ($wrong_groups = group_tools_get_groups_without_acl()) { $rows[] = array(elgg_echo("group_tools:settings:fix:without", array(count($wrong_groups))), elgg_view("output/url", array("href" => "action/group_tools/fix_acl?fix=without", "text" => elgg_echo("group_tools:settings:fix_it"), "class" => "elgg-button elgg-button-action", "is_action" => true, "style" => "white-space: nowrap;", "confirm" => true))); } // fix everything at once if (count($rows) > 1) { $rows[] = array(elgg_echo("group_tools:settings:fix:all:description"), elgg_view("output/url", array("href" => "action/group_tools/fix_acl?fix=all", "text" => elgg_echo("group_tools:settings:fix:all"), "class" => "elgg-button elgg-button-action", "is_action" => true, "style" => "white-space: nowrap;", "confirm" => true))); } if (!empty($rows)) { $content = "<table class='elgg-table'>"; foreach ($rows as $row) { $content .= "<tr><td>" . implode("</td><td>", $row) . "</td></tr>"; } $content .= "</table>"; echo elgg_view_module("inline", elgg_echo("group_tools:settings:fix:title"), $content); }
* -> user_guid => the user that should be added */ add_user_to_access_collection($user_data->user_guid, $user_data->acl_id); } // 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) { /**