Making Email Optional

Making Email Optional

โดย Steven Machonis -
Number of replies: 14
Hello,

I run a moodle website for a local school district, and we use LDAP and Active Directory to authenticate our users. We'd like to make entering an email address optional, because a lot of the younger students don't have their own email address, and also wouldn't be able to check it from school anyway. We just upgraded to 1.7 and I was hoping it would be an option in the new version. When we had 1.5.3, I changed some code to make it work, but It messed some other things up and I'd like to not have to do that again. Any options? Has this been a problem for anyone else?

Thanks!

Steven

การประเมินโดยเฉลี่ย: -
In reply to Steven Machonis

Re: Making Email Optional

โดย Rob Delissen -
We had the same problem, and solved it by puttling a fake email (like change@me.now) in the appropiate field in the active directory.
การประเมินโดยเฉลี่ย: -
In reply to Rob Delissen

Re: Making Email Optional

โดย Vicki Weavers -

Hi Rob

We tried something similar but found that when Moodle tried to send the mail to the fake address (like when the user contributed to a forum) the moodle admin got a load of mails notifying  of undeliverable mail. If we were to do this college wide (our students don't have a college provided email address) we would get unmanageable amounts of mail.

Any ways around this that you have found?

การประเมินโดยเฉลี่ย: -
In reply to Vicki Weavers

Re: Making Email Optional

โดย Randy Orwin -
We use fake email addresses and then inactivated them on the user profiles.  If you need to change lots of profiles just run an sql query finding the email addresses (we assigned the same fake domain name to all users) and changing the emailstop field to 1.  If you need more details let me know.  Works great for us.
การประเมินโดยเฉลี่ย:Useful (1)
In reply to Rob Delissen

Re: Making Email Optional

โดย Ralf Krause -
รูปภาพของPlugin developers รูปภาพของTranslators
I tested it in my local Moodle. Since today there is an additional parameter you can use for the bulk user upload. The parameter "emailstop" does everything you wanted to get.

username, password, firstname, lastname, country, email, emailstop
test1, test1, Test, Eins, GB, test1@mail.com, 0
test2, test2, Test, Zwei, AU, test2@nomail.xy, 1
test3, test3, Test, Drei, US, test3@nomail.xy, 1
test4, test4, Test, Vier, DE, test4@mail.com, 0

The parameter "emailstop" must be set to 1 if the mail address should NOT work. If you set it to 0 then the mail address is switched on. If you want to have all the mail addresses activ then you do not need the additional parameter in your upload file. In my example you see test1 and test4 active and this users will get mails. The mail addresses of test2 and test3 are NOT active and both do not get mails.

I wanted to get this parameter, too. At school we often have users who do not have a mail address when we start with a new Moodle class. Now it's possible to upload ALL users and switch off mailings for those with dummy addresses.

This works in Moodle 1.8.2+ and 1.9 dev after you updated your server with a new version.

Thanks! Ralf
การประเมินโดยเฉลี่ย:Useful (2)
In reply to Ralf Krause

Re: Making Email Optional

โดย Patrick Malley -
Could someone please test this for me, as I'm having trouble getting it to work.

Here's what I'm using:

username,password,firstname,lastname,email,emailstop,lang,idnumber,autosubscribe,maildisplay
test1,secret,bob,mctest,mctest@example.com,1,en_us,34543,0,0

I upload this and get:

"emailstop" is not a valid field name.

Using 1.8.2+
การประเมินโดยเฉลี่ย: -
In reply to Patrick Malley

Re: Making Email Optional

โดย John Isner -
The error message is correct! emailstop is not a valid field name. The only fields that mention "mail" are
  • email
  • mailformat
  • maildisplay
Maybe you meant one of these?
การประเมินโดยเฉลี่ย: -
In reply to John Isner

Re: Making Email Optional

โดย Patrick Malley -
John,

This doesnt make sense! See the conversation I was replying to.

Plus, MoodleDocs has the following:

Turn email off: The parameter emailstop must be set to 1 if the email address should not work. If you set it to 0 then the email address is switched on. If you want to have all the email addresses active then you do not need the additional parameter in your upload file.


Source: http://docs.moodle.org/en/Upload_users

Am I missing something?
การประเมินโดยเฉลี่ย: -
In reply to Patrick Malley

Re: Making Email Optional

โดย John Isner -
I'm not a CVS expert (not even a CVS novice), but checking sourceforge, it looks like emailstop was added to admin/uploaduser.php in revision 1.62, which is tagged as Moodle_19_beta. I don't have admin access to a 1.9 beta site so I can't test it.
การประเมินโดยเฉลี่ย: -
In reply to John Isner

Re: Making Email Optional

โดย Patrick Malley -
Thanks John. This gives me a place to start. Much appreciated.
การประเมินโดยเฉลี่ย: -
In reply to Patrick Malley

Re: Making Email Optional

โดย Patrick Malley -
I added emailstop myself.

Reference: http://moodle.org/mod/forum/discuss.php?d=33371

This did the trick.
การประเมินโดยเฉลี่ย: -
In reply to Patrick Malley

Re: Making Email Optional

โดย Jason Hollowell -
Don't know if this is the correct place to note this but I was just using the uploaduser feature on 1.8.4 and had a problem with uploaded users no appearing from within Moodle (when I searched users). Don't know why, but I ended up having to add "deleted" and then '0' in the deleted column of the csv file to get the created account to appear. I figure it out by going in and messing with the created record in the database and figuring out what made the user appear in Moodle.

Anyway, I added it the same way emailstop was added here.

Jason
การประเมินโดยเฉลี่ย: -
In reply to Steven Machonis

Re: Making Email Optional

โดย Jerry Ostrove -

We had a smiliar problem... when adding users manually after our initial upload.  I blocked the following lines in edit.php in the "user" folder to cause Moodle 1.7 to ignore checking to see if email addresses were the same as an existing user.  Please use at your own risk, as I'm not sure if there are possible negative side effects to doing this.  Our specific problem was new students with the same email address (their parents):

lines 457 - 467

//    } else if ($otheruser = get_record("user", "email", $usernew->email)) {
//       if ($otheruser->id <> $user->id) {
//            $err["email"] = get_string("emailexists");
//       }
    }

//    if (empty($err["email"]) and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
 //       if ($error = email_is_not_allowed($usernew->email)) {
//            $err["email"] = $error;
//        }
 //   }

การประเมินโดยเฉลี่ย: -
In reply to Jerry Ostrove

Re: Making Email Optional

โดย Bethany Scroggins -
Jerry,
If you have upgraded to 1.9, I'm curious whether the same code still applies. We have 1.9, and the same problem, as some of our overseas students all receive email through a single proctor's email address. Did this code fix work even after upgrading your version of Moodle?

Thanks for the help,

Bethany
NationsUniversity
การประเมินโดยเฉลี่ย: -