This is to ask you suport and consider in your plugin that empty email may exist.
Rationale
In our institution we run user sincronization from Moodle against several sources. Not all of these systems are able to require email as mandatory for users. So, it is probable that some cases passes through the systems and arrives into Moodle with user accounts without email.
We are making every now and then pedagogy of the use of those systems to set up always email addresses.
But, it is difficult to remove this problem.
What we face
We love this plugin and commits to the task we ask it perfectly. However, the cli/sync_users.php process throws a lot of warnings related to empty email addresses, from its lib.php, when consider de domain name of the email address.
We see these lines for every single user that has no email:
PHP Warning: Undefined array key 1 in /var/www/html/local/cohortauto/lib.php on line 218
Warning: Undefined array key 1 in /var/www/html/local/cohortauto/lib.php on line 218
PHP Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/html/local/cohortauto/lib.php on line 221
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/html/local/cohortauto/lib.php on line 221
What we propose
Consider that empty email may happen and proceed the same way, but with empty strings in all those cases.
In particular, we have this patch in our institution:
We have applied locally this patch and works like a charm:
# time php local/cohortauto/cli/sync_users.php
Beginning user cohort sync...
Sync for 79055 users finished.
real 6m52.500s
user 4m36.288s
sys 0m10.032s
And it does not present any warning about empty email.
If you consider this, we are pleased to provide a PR with it.
Hi,
This is to ask you suport and consider in your plugin that empty email may exist.
Rationale
In our institution we run user sincronization from Moodle against several sources. Not all of these systems are able to require email as mandatory for users. So, it is probable that some cases passes through the systems and arrives into Moodle with user accounts without email.
We are making every now and then pedagogy of the use of those systems to set up always email addresses.
But, it is difficult to remove this problem.
What we face
We love this plugin and commits to the task we ask it perfectly. However, the cli/sync_users.php process throws a lot of warnings related to empty email addresses, from its lib.php, when consider de domain name of the email address.
We see these lines for every single user that has no email:
What we propose
Consider that empty email may happen and proceed the same way, but with empty strings in all those cases.
In particular, we have this patch in our institution:
The result
We have applied locally this patch and works like a charm:
And it does not present any warning about empty email.
If you consider this, we are pleased to provide a PR with it.
Let us know.