ユーザ登録確認メールの再送について

ユーザ登録確認メールの再送について

- Yosuke Tanaka の投稿
返信数: 2

お世話になっております。

ユーザを登録した際の確認メールが届いていないため再送してほしいという要望をいただきました。

この確認メールを再送する方法はありますでしょうか?

もしない場合、該当ユーザを一度削除し、再度登録し直すという方法をとる、という認識でよろしいでしょうか?

ご回答いただけると幸いです。

よろしくお願いいたします。

Yosuke Tanaka への返信

Re: ユーザ登録確認メールの再送について

- Mitsuhiro Yoshida の投稿
画像 Developers 画像 Particularly helpful Moodlers 画像 Translators

> この確認メールを再送する方法はありますでしょうか?

Moodle 3.9.4+ (Build: 20210219) でしたら、以下のプログラム修正で各ユーザのプロファイルページに「確認メールを再送する」リンクを設置できるかと思います。

修正対象プログラム:
user/profile.php

修正箇所:
219行目

[ 修正前 ]
// Render custom blocks.
$renderer = $PAGE->get_renderer('core_user', 'myprofile');
$tree = core_user\output\myprofile\manager::build_tree($user, $currentuser);
echo $renderer->render($tree);

echo '</div>'; // Userprofile class.

[ 修正後 ]
// Render custom blocks.
$renderer = $PAGE->get_renderer('core_user', 'myprofile');
$tree = core_user\output\myprofile\manager::build_tree($user, $currentuser);
echo $renderer->render($tree);

$sys_context = context_system::instance();

if (has_capability('moodle/site:config', $sys_context) || has_capability('moodle/user:update', $sys_context)) {
echo "<h2>".get_string('emailconfirmationresend')."</h2>";
flush();
echo get_string('email').": <a href='mailto:".$user->email."'>".$user->email."</a>";
if ($_GET['sendrenew']==1) {
if(setnew_password_and_mail($user)) {
echo "<br />".get_string('emailconfirmsentsuccess');
}
else {
echo "<br />".get_string('emailconfirmsentfailure');
}
}
else {
echo "<br /><a href='profile.php?id=".$user->id."&sendrenew=1'>".get_string('emailconfirmationresend')."</a>";
}
echo "<br /><br />";
}

unset($sys_context);

echo '</div>'; // Userprofile class.

参考資料:
[Moodle in English: Re: Is it possible to resend email confirmation messages in Moodle 1.8.4?]
https://moodle.org/mod/forum/discuss.php?d=91377#p1458617

> もしない場合、該当ユーザを一度削除し、再度登録し直すという方法をとる、という認識でよろしいでしょうか?

はい、そうです。

Mitsuhiro Yoshida への返信

Re: ユーザ登録確認メールの再送について

- Yosuke Tanaka の投稿
ご返信いただきありがとうござます!
コードの修正方法まで提示いただき非常に助かりました。