简体   繁体   English

用户注册后的woocommerce hook

[英]After user registration woocommerce hook

I am using user_register hook and trying to get form field values on user registration woocommerce with $_POST.我正在使用 user_register 挂钩并尝试使用 $_POST 获取用户注册 woocommerce 上的表单字段值。 Example: email address.. but value it is not being passed.示例:电子邮件地址.. 但它没有被传递值。 Is there another way i should be doing this or another hook I should use?有没有另一种方法我应该这样做或我应该使用另一个钩子?

add_action( 'user_register', 'epds_registration');
function epds_registration( $user_id ) {

  if ( isset( $_POST['reg_email'] ) ) {
    $email = $_POST['reg_email'];
  }

  $params = array(
    'emailaddr' => $email,
  );

  //connect to API
  $my_plugin = WP_PLUGIN_DIR . '/epdsquotes';
  require $my_plugin . '/class.connect.php';
    
  // Add new customer
  $client->CreateProspect($params);
}

Ah.. .my problem was with $_POST['reg_email'].啊...我的问题是 $_POST['reg_email']。 I was using the id and not the name of field.我使用的是 id 而不是字段的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM