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?
Answers
menasmeans 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.
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 :-)