Make WordPress Core

Ticket #42132: 42132.2.patch

File 42132.2.patch, 2.3 KB (added by anand.au14, 7 years ago)

Added patch to add filter content of email sent on new user joining confirmation

  • wp-admin/user-new.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    5959        }
    6060
    6161        // Adding an existing user to this blog
    62         $new_user_email = $user_details->user_email;
     62        $new_user_email['to'] = $user_details->user_email;
    6363        $redirect = 'user-new.php';
    6464        $username = $user_details->user_login;
    6565        $user_id = $user_details->ID;
     
    102102
    103103Please click the following link to confirm the invite:
    104104%4$s' );
    105                         wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ), home_url( "/newbloguser/$newuser_key/" ) ) );
     105
     106
     107                        $new_user_email['message'] = $message;
     108                        $new_user_email['subject'] = sprintf( __( '[%s] Joining confirmation' ), wp_specialchars_decode( get_option( 'blogname' ) ) );
     109                        $new_user_email['message'] = sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ), home_url( "/newbloguser/$newuser_key/" ) ) );
     110
     111
     112            /**
     113             * Filters the contents of the email sent when a new user is added.
     114             *
     115             * @since
     116             *
     117             * @param array $pass_change_email {
     118             *            Used to build wp_mail().
     119             *            @type string $to      The intended recipients. Add emails in a comma separated string.
     120             *            @type string $subject The subject of the email.
     121             *            @type string $message The content of the email.
     122             *        }
     123             * @param array $user_id     The invided user's ID
     124             * @param array $role        The role of invited user.
     125             * @param string $newuser_key The key of the invitation.
     126             *
     127             */
     128                        $new_user_email = apply_filters('new_user_emails',$new_user_email, $user_id, $role, $newuser_key);
     129
     130                        wp_mail( $new_user_email['to'], $new_user_email['subject'], $new_user_email['message'] );
    106131
    107132                        if ( $switched_locale ) {
    108133                                restore_previous_locale();