email new user Hook

edited July 2017 in WordPress
AFter a user registers for the first time using Social Login. Is there a hook I can use to send the user an email?

Comments

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    Hi Dan,

    which CMS (WordPress, Drupal, Joomla ... ) are you using?
  • Wordpress
  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    edited July 2017
    Hi Dan,

    you can use something like this:

    function custom_oa_social_login_action_after_user_insert($user_data, $identity) { if( ! empty ($user_data->user_email) && strpos($user_data->user_email, 'example') === false) { //The blogname option is escaped with esc_html on the way into the database $blogname = wp_specialchars_decode (get_option ('blogname'), ENT_QUOTES); //Setup Mail $recipient = $user_data->user_email; $subject = 'Welcome to '.$blogname; $body = "Welcome to our blog\r\n\r\n"; $body .= "Your username: ".$user_data->user_login; //Send Mail @wp_mail ($recipient, $subject, $body); } } add_action('oa_social_login_action_after_user_insert', 'custom_oa_social_login_action_after_user_insert', 10, 2);

    I haven't tested the code, so please make sure that it works correctly after having added it.

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.