以下のような記述をfunctions.php内に記述することでcontactform7を使ってユーザー情報変更フォームを作成しているのですが、上のものは動き下のものは動きません。どちらもメール自体は送信されています。
何故なのでしょうか。さっぱり見当もつきません。
php
1add_action('plugins_loaded','wpcf7_insert_counselor_profile'); 2function wpcf7_insert_counselor_profile($contact_form) { 3 $id = $contact_form->id(); 4 $user_id = get_current_user_id(); 5 if($id == 714) { 6 $submission = WPCF7_Submission::get_instance(); 7 if($submission) { 8 $formdata = $submission->get_posted_data(); 9 $meta = ['nickname', 'user_email', 'sex', 'age', 10 'description', 'counseling_number', 'bank', 11 'bank_number', 'bank_type', 'account_number']; 12 foreach ($meta as $data) { 13 if(!empty($formdata[$data])) { 14 update_user_meta($user_id, $data, $formdata[$data]); 15 } 16 } 17 } 18 } 19} 20add_action('wpcf7_mail_sent', 'wpcf7_insert_counselor_profile', 10, 1);
php
1 2add_action('plugins_loaded','wpcf7_insert_counselor'); 3function wpcf7_insert_counselor($contact_form) { 4 $id = $contact_form->id(); 5 $user_id = get_current_user_id(); 6 if($id == 850) { 7 $submission_1 = WPCF7_Submission::get_instance(); 8 if($submission_1) { 9 $formdata = $submission_1->get_posted_data(); 10 $meta = ['user_email','user_phone', 'career', 11 'license',]; 12 foreach ($meta as $data) { 13 if(!empty($formdata[$data])) { 14 update_user_meta($user_id, $data,$formdata[$data]); 15 } 16 } 17 } 18 } 19} 20add_action('wpcf7_mail_sent', 'wpcf7_insert_counselor', 10, 1);
ーーーー以下は動作しないcontactform7の内容です。ーーーー
<label> メールアドレス (必須)
[email* user_email] </label>
<label> 電話番号
[text user_phone] </label>
<label> 資格書
[file license] </label>
<label> 免許書
[file car_license] </label>
<label> 住所
[text address] </label>
<label> 職歴
[textarea career] </label>
[submit "送信"]
ーーーー以下は動作するcontactform7の内容です。ーーーー
<label> メールアドレス (プロフィール情報の変更にメールアドレスの入力は必須です。変更はできません。)
[email* user_email] </label>
<label> お名前
[text nickname] </label>
<label> 性別
[text sex] </label>
<label> 年齢
[text age] </label>
<label> 1日に受けるカウンセリング回数
[text counseling_number] </label>
<label> 銀行名
[text bank] </label>
<label> 店番
[text bank_number] </label>
<label> 口座種類
[text bank_type] </label>
<label> 口座番号
[text account_number] </label>
<label> 取得資格
[text license] </label>
<label> 自己紹介文
[textarea description] </label>
あなたの回答
tips
プレビュー