如何填充名字和姓氏字段(不仅是sliced_invoices_name
字段)?
插件
答案 0 :(得分:0)
只需发布一种解决方案即可在切片发票联系表7扩展名中为用户添加姓氏和名字:
wp-content\plugins\sliced-invoices-contact-form-7\sliced-invoices-contact-form-7.php
更改:
$name = $posted_data['sliced_client_name'];
//在create_new_quote($ posted_data)
收件人:
$fname = $posted_data['sliced_client_fname']; /* REPLACE 'sliced_client_fname' WITH YOUR FIELD NAME IN THE FORM FOR FIRST NAME*/
$lname = $posted_data['sliced_client_lname']; /* REPLACE 'sliced_client_lname' YOUR FIELD NAME IN THE FORM FOR LAST NAME*/
$name = $fname . " " . $lname;
添加fname
和lname
行:
$client_array = array(
'name' => trim( $name ),
'fname' => $fname, /* ADDED */
'lname' => $lname, /* ADDED */
在maybe_add_client( $client_array )
添加:
// create the user
$userdata = array(
'user_login' => $name,
'first_name' => $client_array['fname'], /* ADDED */
'last_name' => $client_array['lname'], /* ADDED */
现在,您可以在“编辑客户端”和“编辑个人资料”视图中看到填充的名字和姓氏字段。
WordPress Codex指定了WordPress用户可以拥有的所有字段(用于wp_insert_user()
函数)。
干杯, 菲比