doudian6229 2015-02-28 21:25
浏览 51
已采纳

too long

I am connecting to an external CRM API where I am trying to create an account using the same username and password (that a customer creates when signing up on the checkout page) for both accounts. It is possible to get the user password before it is hashed with Wordpress?

I am accessing all the other user order info that I need from WooCommerce and passing through the API to the CRM:

$order = new WC_Order($order_id);
$order->billing_first_name;
$order->billing_last_name;
...

I only need the password un-hashed momentarily. I've looked over the WC_Order documentation here: http://docs.woothemes.com/wc-apidocs/class-WC_Order.html and didn't see a good answer.

To be clear, I am not posting the un-hashed password to either database. WP is going to hash the PW and store it as it normally does. I am trying to create another account at the same time with the same username and password via the Neon API http://help.neoncrm.com/node/12. I don't believe this is possible to do if the pw is already hashed by WP.

  • 写回答

1条回答 默认 最新

  • dongwei4652 2015-03-02 16:45
    关注

    I solved the problem with a custom WooCommerce plugin that hooks into

    'woocommerce_order_status_completed'  
    

    This filter needs to be triggered during the checkout phase because we are accessing the password field via $_POST during the checkout/account creation process. To trigger this filter the order status needs to be updated to completed by using this filter:

    'woocommerce_payment_complete_order_status'  
    

    You can see the full method and filter here: http://www.rcorreia.com/woocommerce/woocommerce-automatically-set-order-status-payment-received/

    Inside of the filter method in your plugin or theme for

    'woocommerce_order_status_completed'
    

    the account password can be passed to the Neon api by doing something like:

    $accountPassword = sanitize_text_field($_POST['account_password']);
    

    then passing the other user data request parameters with the password like:

    array( ... 'individualAccount.login.password' => $accountPassword);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了