Zalo hoang an


define('ZALO_APP_ID', 'Key cua ban');
define('ZALO_APP_SECRET', 'Key cua ban');
define('ZALO_APP_CALLBACK_URL',get_bloginfo('url').'/wp-json/login-social/v1/login-zalo-callback');

function process_new_user($email, $first_name, $last_name){

$check_user = email_exists( $email );
$check_user_name = username_exists($email);

if($check_user && $check_user > 0 ){
// is exits
$id_new_user = $check_user;
}else{

if($check_user_name && $check_user_name > 0 ){
$id_new_user = $check_user_name;
}else{
$args = array (
'user_login' => $email,
'user_email' => $email,
'first_name' => $first_name,
'last_name' => $last_name,
'nickname' => $first_name." ".$last_name,
) ;

$id = wp_insert_user( $args ) ;

if(isset($id) && !empty($id)) {
$id_new_user = $id;
}else{
return false;
}
}

}

}