How to add full name automatically
-
Hello everyone,
I’m trying to get the full name automatically added to an account I create. It’s part of my SSO plugin so the full name is already stored in variables (first name and second name are separated).
It seems that wp_create_user() just takes username, password and email as parametres so I cannot use it straight. I also tried to use wp_insert_user to update the data to the account that was just created without full name but didn’t get it working. So any ideas what would be the most elegant way to do this? Thank you very much in advance.
function _create_user($username) { $password = $this->_get_password(); $email_domain = $this->get_option('http_authentication_auto_create_email_domain'); $useCompanyEmail = $this->get_option('http_authentication_auto_use_company_email'); require_once(WPINC . DIRECTORY_SEPARATOR . 'registration.php'); if($useCompanyEmail){ wp_create_user($username, $password, $_SERVER['HTTP_EMAIL']); }else{ wp_create_user($username, $password, $username . ($email_domain ? '@' . $email_domain : '')); } //The following will add the full name to the just created account !!! THIS IS THE PART I COULDN'T GET WORKING !!! $first_name = $_SERVER[HTTP_FIRSTNAME]; $last_name = $_SERVER[HTTP_LASTNAME]; $userdata_new = array(); $userdata_new['user_pass'] = $password; $userdata_new['user_login'] = $username; $userdata_new['first_name'] = $first_name; $userdata_new['last_name'] = $last_name; wp_insert_user($userdata_new); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to add full name automatically’ is closed to new replies.