1
この機能を無効にすることは不可能です。私はので、私はこのフックを追加した別のデータベースに作成したユーザーID、メールとパスワードを送信しようとしている。でもex_create_new_customerZ
に関数名を変更Woocommerce - override wc_create_new_customer
function ex_create_new_customer($email, $username = '', $password = '') {
// add to datastory BD
/* GenSalt */
$string = str_shuffle(mt_rand());
$salt = uniqid($string ,true);
$rounds = 12;
$crypted_password = crypt($_POST['password'], '$2y$'. $rounds . '$' . $salt);
/*request sql*/
$servername = "server_address";
$username = "my_user";
$passworddb = "user_pass_for_db";
$conn = new PDO("mysql:host=$servername;dbname=db_name", $username, $passworddb);
try {
$conn->exec("INSERT INTO user(user_nom, user_prenom, user_mdp, user_mail) VALUES('".$_POST['billing_last_name']."', '".$_POST['billing_first_name']."', '".$crypted_password."', '0', '".$_POST['email']."')");
} catch(PDOException $e) {
die($e->getMessage());
}
}
add_action('wc_create_new_customer', 'ex_create_new_customerZ', 1 , 3);
はエラーをトリガしません。
ありがとうございます 'add_action( 'woocommerce_created_customer'、 'ex_create_ new_customer'、99,3);'が動作します – Core972
リモートサーバからのデータを追加する場合に使用できるフィルタが1つありますwp_insert_userコマンドを使用します。 – Benoti