Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is it possible to change the moodle Administrator Email and Smtp from code editor, not the GUI? I′ve been researching and trying by my own but still not having any reault. Thanks in advance!

question from:https://stackoverflow.com/questions/65546838/change-administrator-email-from-code-lines-in-moodle

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
656 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can update DB records, in example:

$admin = $DB->get_record('user',['email'=>'oldadminemail@mail.com']);
$admin->email = 'newadminemail@mail.com';
$DB->update_record('user',$admin);

More information can be found here: https://docs.moodle.org/dev/Data_manipulation_API


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...