Reviewed:  https://reviews.mahara.org/12368
Committed: 
https://git.mahara.org/mahara/mahara/commit/b824ab045af93ac31e639e0317e563f7a80900f6
Submitter: Robert Lyon (robe...@catalyst.net.nz)
Branch:    21.10_DEV

commit b824ab045af93ac31e639e0317e563f7a80900f6
Author: Ghada El-Zoghbi <gh...@catalyst-au.net>
Date:   Fri Jan 21 09:04:46 2022 +1300

Bug 1958499: Failed user upload csv email problem

The accumulated failed users array is not being set correctly
as it resets on every loop

Change-Id: Ic1f7abf0197bad29502c6f651dacf19c8c41e320
Signed-off-by: Robert Lyon <robe...@catalyst.net.nz>
(cherry picked from commit 0e8e1151460b2d1dbc9ea54187b8ba53c0201c97)

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/1958499

Title:
  Upload CSV Users Bug with Failed Emails

Status in Mahara:
  Fix Committed
Status in Mahara 20.10 series:
  In Progress
Status in Mahara 21.04 series:
  Fix Committed
Status in Mahara 21.10 series:
  Fix Committed
Status in Mahara 22.04 series:
  Fix Committed

Bug description:
  Mahara: 21.10.0
  OS: Linux 20.04
  DB: Postgres
  Browser: n/a

  While implementing a customisation for a client, we identified a very
  old bug in htdocs/admin/users/uploadcsv.php.

  The setting of the `$failedusers` array on line 639 occurs within the
  foreach loop. Which means, the data in the $failedusers array gets
  reset after each iteration.

  The initialisation of $failedusers should occur outside of the foreach
  loop.

  
  
https://github.com/MaharaProject/mahara/blob/main/htdocs/admin/users/uploadcsv.php#L644-L667

  
  This is the current code at line 637:

  if ($values['emailusers'] && $addedusers) {
          foreach ($addedusers as $user) {
              $failedusers = array();
              try {
              ...

  It should be:

  if ($values['emailusers'] && $addedusers) {
          $failedusers = array();     <- MOVE outside the foreach loop
          foreach ($addedusers as $user) {
              try {
              ...

  
  Hope that makes sense.

  Thank you.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1958499/+subscriptions


_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : mahara-contributors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to