新規会員登録できなくなり、直せない
-
お世話になります。
WordPress 5.6.3 です。WordPress初心者です。
子テーマにfunctions.phpを作成し、そこでユーザ登録関連で自動送信されるメールの文章のカスタマイズをおこなっております。
ソースはネット上で見つけたものを解る範囲で加工して作成中です。ダッシュボードでユーザー新規登録をおこなって保存ボタンを押したところ、真っ白の画面に文章が掲載されるだけのエラー画面が出ました。デバッグせよとの表示が出て、サイトが使えなくなるのでは?と思い、恐ろしくなっております。
メッセージは以下でした。「このサイトで重大なエラーが発生しました。対応手順については、サイト管理者のメール受信ボックスを確認してください。
WordPress でのデバッグをさらに詳しく見る。」ちなみにメールは届いていませんでした。
デバッグというものをおこなってlogをWebサーバに保存するように設定してみたところ、三つのエラーが出ました。そのうち一つは運が良くて解決できたのですが、残り二つが直せません。
以下がエラーメッセージです。[26-Apr-2021 08:05:16 UTC] PHP Notice: Undefined variable: user_login in /usr/home/myacout/html/wordpress/wp-content/themes/mytheme-child/functions.php on line 155 [26-Apr-2021 08:05:16 UTC] PHP Notice: Undefined variable: user_login in /usr/home/myacout/html/wordpress/wp-content/themes/mytheme-child/functions.php on line 181
二つとも同じエラーの内容なので、一つ直せば二つ目も直るとは思うのですが、未定義の変数と書かれても何をどう直せば良いのか判らない状態です。
以下が該当のソース箇所です(個人情報がわからにように編集しております。ご了承下さい)。
どのようにして直せば再びユーザー登録が可能になるでしょうか。
宜しくお願いします。/* 送信元のメールアドレスをカスタマイズ */ function custom_mail_from( $email ) { return 'contact@mysite.jp'; } add_filter( 'wp_mail_from', 'custom_mail_from' ); /* 送信メールの差出人名をカスタマイズ */ function custom_mail_from_name( $email_from ) { return 'MySiteName'; } add_filter( 'wp_mail_from_name', 'custom_mail_from_name' ); function custom_new_user_notification_email( $new_user_notification_email, $user, $blogname ) { $subject = '【' . $blogname . '】ユーザーアカウント発行のお知らせ'; $user_name = stripslashes( $user->user_login ); $user_email = stripslashes( $user->user_email ); $message = $user_name . ' 様' . "\r\n"; $message .= "\r\n"; $message .= '「' . $blogname . '」の' . "\r\n"; $message .= 'ユーザーアカウントを発行いたしましたので、お知らせします。' . "\r\n"; $message .= "\r\n"; $message .= 'ユーザー名 :' . $user_name . "\r\n"; $message .= 'メールアドレス:' . $user_email . "\r\n"; $message .= "\r\n"; $message .= 'まずはじめに、以下の「パスワードリセット(変更)URL」の画面で' . "\r\n"; $message .= 'お客様独自のパスワードへ変更する手続きをおこないます。' . "\r\n"; $message .= "\r\n"; $message .= '・パスワードリセット(変更)URL' . "\r\n"; $message .= network_site_url( "wp-login.php?action=lostpassword" . rawurlencode( $user_login ), 'login' ) . "\r\n"; $message .= "\r\n"; $message .= "\r\n"; $message .= '[2] ' . $blogname . ' へログインする' . "\r\n"; $message .= "\r\n"; $message .= 'パスワードのリセット(変更)が完了したら、以下の「ログインURL」を開いて' . "\r\n"; $message .= 'ID(ご登録メールアドレス または ユーザー名)と変更したパスワード、' . "\r\n"; $message .= 'を入力してログインします。' . "\r\n"; $message .= "\r\n"; $message .= '・ログインURL' . "\r\n"; $message .= network_site_url( "wp-login.php" . rawurlencode( $user_login ), 'login' ) . "\r\n"; $message .= "\r\n"; //件名とメッセージを表示 $new_user_notification_email[ 'subject' ] = $subject; $new_user_notification_email[ 'message' ] = $message; return $new_user_notification_email; } add_filter( 'wp_new_user_notification_email', 'custom_new_user_notification_email', 10 , 3 );
- トピック「新規会員登録できなくなり、直せない」には新たに返信することはできません。