2) のフックは無いですね。
そのメールはWordPress本体の wp-includes/pluggable.php
にある
関数 wp_password_change_notification
が送っています。
ghvstさん
ご回答ありがとうございました。
標準の通知メール関係はフックがほしいところですね。
解決済みになっていますが、
標準の通知メール関係はフックがほしいところですね。
プラグアブル関数は、フックがなくてもカスタマイズができるように作られている関数なので、
例えば、以下のような、ナンツッテプラグインを作ると オーバーライドできます。
プラグインディレクトリに、
my-test.php を作成して、
<?php
/*
Plugin Name: My Pluggable
Description:
Version: 1.0
*/
if( ! function_exists('wp_password_change_notification') ) {
function wp_password_change_notification(&$user) {
// send a copy of password change notification to the admin
// but check to see if it's the admin whose password we're changing, and skip this
if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
$message = sprintf(__('Ahaha Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
wp_mail(get_option('admin_email'), sprintf(__('[%s] Ahaha Password Lost/Changed'), $blogname), $message);
}
}
}
プラグインをアクティブにすると、
Ahaha Password Lost and Changed for user
というメールが届くようになります。
上の例では、Ahahaの部分が追加メッセージです。
好きなように、全部カスタマイズできると思いますよ
nobitaさん
アドバイスありがとうございます。
さっそくやってみました。簡単にできるんですね。
普段は専らテンプレートとfundtions.phpばかりいじっていて、
プラグインはチャレンジしてませんでした。
WPの活用範囲が大きく広がった感じです。
本当にありがとうございました!