WooCommerce, New User Registration E-Mail?

edited April 2016 in WordPress
I'm using OneAll Social Login for Wordpress. When someone registers using a social acount they do not receive a reigistration e-mail.
When someone registers normally using e-mail and password the registration e-mail is sent.

I understand that for some social accounts retrieving the email is not possible and we end up with @example.com, I'm ok with that. We have an option for asking the user for a valid e-mail.

This is happening for people with valid e-mail address, not the auto-generated ones.

Do I have to capture action oa_social_login_action_after_user_insert and send the e-mail myself?

Best Answer

  • Fred_PinelFred_PinelMember
    Answer ✓
    Hi,
    Yes. The social plugin shown on the My Account does not follow the Woocommerce registration flow.

    Regards.

Answers

  • Note: Forgot to mention, this is with Woocommerce customer E-mails.
  • Ed_BurgosEd_BurgosMember
    edited April 2016
    So, for those looking for an answer I ended up adding this to my funcitons.php to make it work, please feel free to improve on it. I'm by no menas means a PHP/Wordpress programmer:

    require_once(ABSPATH . 'wp-content/plugins/woocommerce/includes/emails/class-wc-email.php'); require_once(ABSPATH . 'wp-content/plugins/woocommerce/includes/emails/class-wc-email-customer-new-account.php'); if( !class_exists('Emogrifier') && class_exists('DOMDocument')){ include_once(ABSPATH . 'wp-content/plugins/woocommerce/includes/libraries/class-emogrifier.php'); } function custom_oa_social_login_action_after_user_insert($user_data, $identity){ if(strpos($user_data->user_email, 'example.com') !== false){ $wc_emails = new WC_Email_Customer_New_Account(); $wc_emails->trigger($user_data->ID, '', false); } } add_action('oa_social_login_action_after_user_insert', 'custom_oa_social_login_action_after_user_insert', 10, 2);


    Note: The code may contain typos. I could not copy/paste it from the funcitons.php directly. I had to re-write it based on a screenshot because I'm at work and do not have full access to my VPS.
  • Hi,
    Thanks for your contribution!
    Based on your solution, here is an alternative (without the check for the bogus example.com):
    add_action('oa_social_login_action_after_user_insert', 'oa_send_wc_email', 10, 2); function oa_send_wc_email( $user_data, $identity ) { $wc = new WC_Emails(); $wc->customer_new_account( $user_data->ID ); }There are probably some nice Woocommerce hooks to use, but couldn't get them to work :-)

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.