0
votes

I want to create a custom registration for and I need to create a new custom field for each profile. For example a phone field.

Here's my code

function registration()
{

    $userdata = array(
        'user_login' => esc_attr($this->username),
        'phone' => esc_attr($this->username),
        'pre_user_email' => esc_attr($this->email),
        'user_pass' => esc_attr($this->password),
        'user_url' => esc_attr($this->website),
        'first_name' => esc_attr($this->first_name),
        'last_name' => esc_attr($this->last_name),
        'nickname' => esc_attr($this->nickname),
        'description' => esc_attr($this->bio),
    );

The phone line is my custom field for profile. It doesn't work, I've tried creating a custom field in the admin user panel, and it works! But I can't insert data to that field phone

1

1 Answers

1
votes
 function registration()
 {
    $userdata = array(
        'user_login' => esc_attr($this->username),
        'phone' => esc_attr($this->phone),
        'pre_user_email' => esc_attr($this->email),
        'user_pass' => esc_attr($this->password),
        'user_url' => esc_attr($this->website),
        'first_name' => esc_attr($this->first_name),
        'last_name' => esc_attr($this->last_name),
        'nickname' => esc_attr($this->nickname),
        'description' => esc_attr($this->bio),
    );
 }

You should add 'phone' string on MySQL db