• Hi, I created a new role and when I manually added someone as this role, despite having all emails in woo turned off except order related emails they were sent an email that says

    “Username: xxxxxxxx
    To set your password, visit the following address: xxxxxx”

    How do I disable this or if I can’t, how do I edit the copy?

    your help would be much appreciated

    thanks

Viewing 1 replies (of 1 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    When you create new user there is checkbox “Send the new user an email about their account.”. If you did not un-check it, WordPress itself send the notification email message. It’s built by this function:

    /**
    	 * Email login credentials to a newly-registered user.
    	 *
    	 * A new user registration notification is also sent to admin email.
    	 *
    	 * @since 2.0.0
    	 * @since 4.3.0 The <code>$plaintext_pass</code> parameter was changed to <code>$notify</code>.
    	 * @since 4.3.1 The <code>$plaintext_pass</code> parameter was deprecated. <code>$notify</code> added as a third parameter.
    	 * @since 4.6.0 The <code>$notify</code> parameter accepts 'user' for sending notification only to the user created.
    	 *
    	 * @param int    $user_id    User ID.
    	 * @param null   $deprecated Not used (argument deprecated).
    	 * @param string $notify     Optional. Type of notification that should happen. Accepts 'admin' or an empty
    	 *                           string (admin only), 'user', or 'both' (admin and user). Default empty.
    	 */
    	function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {

    You can modify message content and other parameters via custom filter ‘wp_new_user_notification_email’:

    $wp_new_user_notification_email = array(
    			'to'      => $user->user_email,
    			/* translators: Login details notification email subject. %s: Site title. */
    			'subject' => __( '[%s] Login Details' ),
    			'message' => $message,
    			'headers' => '',
    		);
    
    		/**
    		 * Filters the contents of the new user notification email sent to the new user.
    		 *
    		 * @since 4.9.0
    		 *
    		 * @param array   $wp_new_user_notification_email {
    		 *     Used to build wp_mail().
    		 *
    		 *     @type string $to      The intended recipient - New user email address.
    		 *     @type string $subject The subject of the email.
    		 *     @type string $message The body of the email.
    		 *     @type string $headers The headers of the email.
    		 * }
    		 * @param WP_User $user     User object for new user.
    		 * @param string  $blogname The site title.
    		 */
    		$wp_new_user_notification_email = apply_filters( 'wp_new_user_notification_email', $wp_new_user_notification_email, $user, $blogname );
    
    		wp_mail(
    			$wp_new_user_notification_email['to'],
    			wp_specialchars_decode( sprintf( $wp_new_user_notification_email['subject'], $blogname ) ),
    			$wp_new_user_notification_email['message'],
    			$wp_new_user_notification_email['headers']
    		);
Viewing 1 replies (of 1 total)
  • The topic ‘User role email’ is closed to new replies.