• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / edd_new_user_notification() – Sends the new user notification email when a user registers during checkout

You appear to be a bot. Output may be restricted

Description

Sends the new user notification email when a user registers during checkout

Usage

edd_new_user_notification( $user_id, $user_data );

Parameters

$user_id
( int ) optional –
$user_data
( array ) optional –

Returns

void void

Source

File name: easy-digital-downloads/includes/user-functions.php
Lines:

1 to 56 of 56
function edd_new_user_notification( $user_id = 0, $user_data = array() ) {

  if( empty( $user_id ) || empty( $user_data ) ) {
    return;
  }

  $emails     = EDD()->emails;
  $from_name  = edd_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
  $from_email = edd_get_option( 'from_email', get_bloginfo( 'admin_email' ) );

  // Setup and send the new user email for Admins.
  $emails->__set( 'from_name', $from_name );
  $emails->__set( 'from_email', $from_email );

  $admin_subject  = apply_filters( 'edd_user_registration_admin_email_subject', sprintf( __('[%s] New User Registration', 'easy-digital-downloads' ), $from_name ), $user_data );
  $admin_heading  = apply_filters( 'edd_user_registration_admin_email_heading', __( 'New user registration', 'easy-digital-downloads' ), $user_data );
  $admin_message  = sprintf( __( 'Username: %s', 'easy-digital-downloads'), $user_data['user_login'] ) . "\r\n\r\n";
  $admin_message .= sprintf( __( 'E-mail: %s', 'easy-digital-downloads'), $user_data['user_email'] ) . "\r\n";

  $admin_message = apply_filters( 'edd_user_registration_admin_email_message', $admin_message, $user_data );

  $emails->__set( 'heading', $admin_heading );

  $emails->send( get_option( 'admin_email' ), $admin_subject, $admin_message );

  // Setup and send the new user email for the end user.
  $user_subject  = apply_filters( 'edd_user_registration_email_subject', sprintf( __( '[%s] Your username and password', 'easy-digital-downloads' ), $from_name ), $user_data );
  $user_heading  = apply_filters( 'edd_user_registration_email_heading', __( 'Your account info', 'easy-digital-downloads' ), $user_data );
  $user_message  = apply_filters( 'edd_user_registration_email_username', sprintf( __( 'Username: %s', 'easy-digital-downloads' ), $user_data['user_login'] ) . "\r\n", $user_data );

  if ( did_action( 'edd_pre_process_purchase' ) ) {
    $password_message = __( 'Password entered at checkout', 'easy-digital-downloads' );
  } else {
    $password_message = __( 'Password entered at registration', 'easy-digital-downloads' );
  }

  $user_message .= apply_filters( 'edd_user_registration_email_password', sprintf( __( 'Password: %s', 'easy-digital-downloads' ), '[' . $password_message . ']' ) . "\r\n" );

  $login_url = apply_filters( 'edd_user_registration_email_login_url', wp_login_url() );
  if( $emails->html ) {

    $user_message .= '<a href="' . $login_url . '"> ' . esc_attr__( 'Click here to log in', 'easy-digital-downloads' ) . ' &raquo;</a>' . "\r\n";

  } else {

    $user_message .= sprintf( __( 'To log in, visit: %s', 'easy-digital-downloads' ), $login_url ) . "\r\n";

  }

  $user_message = apply_filters( 'edd_user_registration_email_message', $user_message, $user_data );

  $emails->__set( 'heading', $user_heading );

  $emails->send( $user_data['user_email'], $user_subject, $user_message );

}
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 23rd February 2021

Primary Sidebar

Information

Function name: edd_new_user_notification
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/user-functions.php
File ref: includes/user-functions.php
Deprecated?: No
API Letters: E,N,U

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.9.3
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites