diff --git a/README.md b/README.md index 9b440bb..81fcbef 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Group Tools =========== -![Elgg 5.0](https://img.shields.io/badge/Elgg-5.0-green.svg) +![Elgg 5.1](https://img.shields.io/badge/Elgg-5.1-green.svg) ![Lint Checks](https://github.com/ColdTrick/group_tools/actions/workflows/lint.yml/badge.svg?event=push) [![Latest Stable Version](https://poser.pugx.org/coldtrick/group_tools/v/stable.svg)](https://packagist.org/packages/coldtrick/group_tools) [![License](https://poser.pugx.org/coldtrick/group_tools/license.svg)](https://packagist.org/packages/coldtrick/group_tools) diff --git a/actions/groups/edit.php b/actions/groups/edit.php index c1b0653..c22552c 100644 --- a/actions/groups/edit.php +++ b/actions/groups/edit.php @@ -141,7 +141,7 @@ // Invisible group support + admin approve check // @todo this requires save to be called to create the acl for the group. This // is an odd requirement and should be removed. Either the acl creation happens -// in the action or the visibility moves to a plugin hook +// in the action or the visibility moves to an event handler $admin_approve = (bool) (elgg_get_plugin_setting('admin_approve', 'group_tools') == 'yes'); $admin_approve = ($admin_approve && !elgg_is_admin_logged_in()); // admins don't need to wait diff --git a/classes/ColdTrick/GroupTools/Cron.php b/classes/ColdTrick/GroupTools/Cron.php index c855b39..05648ca 100644 --- a/classes/ColdTrick/GroupTools/Cron.php +++ b/classes/ColdTrick/GroupTools/Cron.php @@ -19,9 +19,6 @@ class Cron { * @return void */ public static function notifyStaleGroupOwners(\Elgg\Event $event): void { - echo 'Starting GroupTools stale group owners' . PHP_EOL; - elgg_log('Starting GroupTools stale group owners', 'NOTICE'); - $time = (int) $event->getParam('time', time()); // get stale groups @@ -29,10 +26,6 @@ public static function notifyStaleGroupOwners(\Elgg\Event $event): void { return self::findStaleGroups($time); }); if (empty($groups)) { - // non found - echo 'Done with GroupTools stale group owners' . PHP_EOL; - elgg_log('Done with GroupTools stale group owners', 'NOTICE'); - return; } @@ -53,9 +46,6 @@ public static function notifyStaleGroupOwners(\Elgg\Event $event): void { self::notifyStaleGroupOwner($group); } }); - - echo 'Done with GroupTools stale group owners' . PHP_EOL; - elgg_log('Done with GroupTools stale group owners', 'NOTICE'); } /** @@ -249,9 +239,6 @@ public static function removeExpiredConceptGroups(\Elgg\Event $event): void { return; } - echo 'Starting concept group cleanup' . PHP_EOL; - elgg_log('Starting concept group cleanup', 'NOTICE'); - elgg_call(ELGG_IGNORE_ACCESS, function() use ($days) { /* @var $groups \ElggBatch */ $groups = elgg_get_entities([ @@ -273,9 +260,6 @@ public static function removeExpiredConceptGroups(\Elgg\Event $event): void { } } }); - - echo 'Done with concept group cleanup' . PHP_EOL; - elgg_log('Done with concept group cleanup', 'NOTICE'); } /** @@ -292,9 +276,6 @@ public static function notifyConceptGroupOwners(\Elgg\Event $event): void { $days = (int) elgg_get_plugin_setting('concept_groups_retention', 'group_tools'); - echo 'Starting concept group owner notification' . PHP_EOL; - elgg_log('Starting concept group owner notification', 'NOTICE'); - elgg_call(ELGG_IGNORE_ACCESS, function() use ($days) { $site = elgg_get_site_entity(); $current_language = elgg()->translator->getCurrentLanguage(); @@ -347,8 +328,5 @@ public static function notifyConceptGroupOwners(\Elgg\Event $event): void { // restore language elgg()->translator->setCurrentLanguage($current_language); }); - - echo 'Done with concept group owner notification' . PHP_EOL; - elgg_log('Done with concept group owner notification', 'NOTICE'); } } diff --git a/composer.json b/composer.json index 950df81..6ecb5a5 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "composer/installers": "^1.0.8" }, "conflict": { - "elgg/elgg": "<5.0" + "elgg/elgg": "<5.1" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index e5644de..48709e5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "42e24a65d16b4d8b125642ba3577f5f9", + "content-hash": "d4f8e1ff9a3bf9051fccd6beba6f7c5b", "packages": [ { "name": "composer/installers", @@ -166,5 +166,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/lib/functions.php b/lib/functions.php index 7d99f25..3f88e8b 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -19,7 +19,7 @@ */ function group_tools_check_group_email_invitation(string $invite_code, int $group_guid = 0): ?\ElggGroup { if (empty($invite_code) || !Base64Url::decode($invite_code)) { - return false; + return null; } $options = [ diff --git a/views/default/forms/group_tools/mail.php b/views/default/forms/group_tools/mail.php index e08c22a..2bfa983 100644 --- a/views/default/forms/group_tools/mail.php +++ b/views/default/forms/group_tools/mail.php @@ -37,7 +37,7 @@ 'show_friends' => false, 'handler' => 'livesearch/group_members', 'options' => [ - 'match_target' => $group->guid, + 'group_guid' => $group->guid, ], ], [ diff --git a/views/default/resources/groups/email_invitations.php b/views/default/resources/groups/email_invitations.php index de5cd91..f1bada7 100644 --- a/views/default/resources/groups/email_invitations.php +++ b/views/default/resources/groups/email_invitations.php @@ -9,8 +9,7 @@ /* @var $group \ElggGroup */ $group = elgg_get_page_owner_entity(); -elgg_push_breadcrumb(elgg_echo('groups'), elgg_generate_url('collection:group:group:all')); -elgg_push_breadcrumb($group->getDisplayName(), $group->getURL()); +elgg_push_entity_breadcrumbs($group); // additional title menu item if ($group->canEdit() && elgg_is_active_plugin('friends')) { diff --git a/views/default/resources/groups/invite.php b/views/default/resources/groups/invite.php index 9efd5ac..9771e63 100644 --- a/views/default/resources/groups/invite.php +++ b/views/default/resources/groups/invite.php @@ -22,8 +22,7 @@ throw $ex; } -elgg_push_breadcrumb(elgg_echo('groups'), elgg_generate_url('collection:group:group:all')); -elgg_push_breadcrumb($group->getDisplayName(), $group->getURL()); +elgg_push_entity_breadcrumbs($group); $content = elgg_view_form('groups/invite', [ 'id' => 'invite_to_group', diff --git a/views/default/resources/groups/mail.php b/views/default/resources/groups/mail.php index 1d69a95..6a6fdfd 100644 --- a/views/default/resources/groups/mail.php +++ b/views/default/resources/groups/mail.php @@ -18,8 +18,7 @@ elgg_set_context('groups'); // set breadcrumb -elgg_push_breadcrumb(elgg_echo('groups'), elgg_generate_url('collection:group:group:all')); -elgg_push_breadcrumb($group->getDisplayName(), $group->getURL()); +elgg_push_entity_breadcrumbs($group); // build page elements $form_vars = [ diff --git a/views/default/resources/groups/members.php b/views/default/resources/groups/members.php index 976e909..1c43385 100644 --- a/views/default/resources/groups/members.php +++ b/views/default/resources/groups/members.php @@ -7,8 +7,7 @@ $group = elgg_get_page_owner_entity(); -elgg_push_breadcrumb(elgg_echo('groups'), elgg_generate_url('collection:group:group:all')); -elgg_push_breadcrumb($group->getDisplayName(), $group->getURL()); +elgg_push_entity_breadcrumbs($group); if ($group->canEdit() && elgg_is_active_plugin('friends')) { elgg_register_menu_item('title', [ diff --git a/views/default/resources/groups/related.php b/views/default/resources/groups/related.php index 52ab872..6bdf7eb 100644 --- a/views/default/resources/groups/related.php +++ b/views/default/resources/groups/related.php @@ -8,8 +8,7 @@ $group = elgg_get_page_owner_entity(); // build breadcrumb -elgg_push_breadcrumb(elgg_echo('groups'), elgg_generate_url('collection:group:group:all')); -elgg_push_breadcrumb($group->getDisplayName(), $group->getURL()); +elgg_push_entity_breadcrumbs($group); // page elements $content = ''; diff --git a/views/json/resources/livesearch/group_members.php b/views/json/resources/livesearch/group_members.php index 7ee42dc..fbee7b4 100644 --- a/views/json/resources/livesearch/group_members.php +++ b/views/json/resources/livesearch/group_members.php @@ -1,4 +1,14 @@ $query, 'type' => 'user', + 'relationship' => 'member', + 'relationship_guid' => $group_guid, + 'inverse_relationship' => true, 'limit' => $limit, 'sort_by' => [ 'property_type' => 'metadata', @@ -26,9 +39,6 @@ 'fields' => ['metadata' => ['name', 'username']], 'item_view' => elgg_extract('item_view', $vars, 'search/entity'), 'input_name' => $input_name, - 'relationship' => 'member', - 'relationship_guid' => $target->guid, - 'inverse_relationship' => true, ]; // by default search in all users,