简体   繁体   中英

After user registration woocommerce hook

I am using user_register hook and trying to get form field values on user registration woocommerce with $_POST. 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']. I was using the id and not the name of field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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