Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function edd_new_user_notification_custom( $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 the end user.
- $user_subject = apply_filters( 'edd_user_registration_email_subject', sprintf( __( 'New account created', '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 : Test', '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' ) . ' »</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 );
- }
- remove_action('edd_insert_user', 'edd_new_user_notification');
- add_action('edd_insert_user', 'edd_new_user_notification_custom',10,2);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement