Is it possible to resend email confirmation messages in Moodle 1.8.4?
Thanks,
Bill Plumstead
Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?
I found that you can reconstruct the confirmation link from data in the database. To reconstruct the URL, the link can be built by using the values of USER.SECRET and USER.USERNAME. Here's how the link would be constructed:
$CFG->WWWROOT/login/confirm.php?data=[USER.SECRET]/[USER.USERNAME]
Where $CFG->WWWROOT is the root of your moodle installation and [USER.SECRET] and [USER.USERNAME] are values from the USER table.
Thanks,
Bill Plumstead
Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?
Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?
Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?
Include this line of code in index.php which u will find in login folder
echo '<a id="btnresend" href="Resendemailmessage.php?'. send_confirmation_email($user). '">Resend Mail</a>';
Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?
Hi there,
I need to do this but I cannot find a file called Resendemailmessage.php
Where is it please?
Cheers
Dave
Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?
As I'm using Moodle 2.9.3 this file doesn't seem to exist, however there is a function within moodlelib.php called setnew_password_and_mail($user) which does this.
I've added the following code to /user/profile.php at the end of the file, under the line: echo $renderer->render($tree);
if (is_siteadmin()) {
echo "<h2>Sending eMails</h2>";
echo "email address is:<a href='mailto:".$user->email."'>".$user->email."</a>";
if ($_GET['sendrenew']==1) {
if(setnew_password_and_mail($user)) {
echo "<br>Introductory email re-sent";
}
else {
echo "<br>Introductory email failed to send";
}
}
else {
echo "<br><br><a href='profile.php?id=".$user->id."&sendrenew=1'>Resend introductory email</a>";
}
}
Couple of things:
- I know my coding isn't great.
- I read somewhere that is_siteadmin() was being deprecated.
Hope this helps.
Dave Emsley
Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?
Thanks Dave, I tested it on 3.0.X and runs perfect.
Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?
Legend! Thanks!!
Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?
Dave, I modified a bit your code to avoid the deprecated is_siteadmin() function.
Only the users who have the capabilities of editing profiles or modifying the site config will see and use the new function.
$sys_context = context_system::instance();
if ( has_capability('moodle/site:config', $sys_context) or has_capability('moodle/user:update', $sys_context) ) {
echo "<h2>Sending eMails</h2>";
flush();
echo "email address is:<a href='mailto:".$user->email."'>".$user->email."</a>";
if ($_GET['sendrenew']==1) {
if(setnew_password_and_mail($user)) {
echo "<br>Introductory email re-sent";
}
else {
echo "<br>Introductory email failed to send";
}
}
else {
echo "<br><br><a href='profile.php?id=".$user->id."&sendrenew=1'>Resend introductory email</a>";
}
}
unset($sys_context);