From 5cebd28de87a46cc58753a5f40423fc5ce9361a2 Mon Sep 17 00:00:00 2001 From: Jerome Bakker Date: Tue, 26 May 2020 10:51:35 +0200 Subject: [PATCH] fixed: inviting all site members crashed the invite action --- actions/groups/invite.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/actions/groups/invite.php b/actions/groups/invite.php index 0b4bb5ac..73f2d55f 100644 --- a/actions/groups/invite.php +++ b/actions/groups/invite.php @@ -17,17 +17,19 @@ $adding = false; if (elgg_is_admin_logged_in()) { // add all users? - if (get_input('all_users') == 'yes') { - $site = elgg_get_site_entity(); + if (get_input('all_users') === 'yes') { + // this could take a while + set_time_limit(0); - $options = [ + // prepare a batch for memory saving + $user_guids = elgg_get_entities([ + 'type' => 'user', 'limit' => false, 'callback' => function ($row) { return (int) $row->guid; }, - ]; - - $user_guids = $site->getMembers($options); + 'batch' => true, + ]); } // add users directly? @@ -44,7 +46,7 @@ $csv = elgg_get_uploaded_file('csv'); $resend = false; -if (get_input('resend') == 'yes') { +if (get_input('resend') === 'yes') { $resend = true; }