• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / wpmu_signup_user_notification() – Send a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked.

You appear to be a bot. Output may be restricted

Description

Send a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked.

This is the notification function used when no new site has been requested. Filter wpmu_signup_user_notification to bypass this function or replace it with your own notification behavior. Filter wpmu_signup_user_notification_email and wpmu_signup_user_notification_subject to change the content and subject line of the email sent to newly registered users.

Usage

$bool = wpmu_signup_user_notification( $user_login, $user_email, $key, $meta );

Parameters

$user_login
( string ) required – The user's login name.
$user_email
( string ) required – The user's email address.
$key
( string ) required – The activation key created in wpmu_signup_user()
$meta
( array ) optional – Optional. Signup meta data. Default empty array.

Returns

bool

Source

File name: wordpress/wp-includes/ms-functions.php
Lines:

1 to 86 of 86
function wpmu_signup_user_notification( $user_login, $user_email, $key, $meta = array() ) {
  
/**
 * Filters whether to bypass the email notification for new user sign-up.
 *
 * @since MU (3.0.0)
 *
 * @param string $user_login User login name.
 * @param string $user_email User email address.
 * @param string $key        Activation key created in wpmu_signup_user().
 * @param array  $meta       Signup meta data. Default empty array.
 */
  if ( ! apply_filters( 'wpmu_signup_user_notification', $user_login, $user_email, $key, $meta ) ) {
    return false;
  }

  $user            = get_user_by( 'login', $user_login );
  $switched_locale = switch_to_locale( get_user_locale( $user ) );

  // Send email with activation link.
  $admin_email = get_site_option( 'admin_email' );

  if ( '' === $admin_email ) {
    $admin_email = 'support@' . wp_parse_url( network_home_url(), PHP_URL_HOST );
  }

  $from_name       = ( '' !== get_site_option( 'site_name' ) ) ? esc_html( get_site_option( 'site_name' ) ) : 'WordPress';
  $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";
  $message         = sprintf(
    
/**
 * Filters the content of the notification email for new user sign-up.
 *
 * Content should be formatted for transmission via wp_mail().
 *
 * @since MU (3.0.0)
 *
 * @param string $content    Content of the notification email.
 * @param string $user_login User login name.
 * @param string $user_email User email address.
 * @param string $key        Activation key created in wpmu_signup_user().
 * @param array  $meta       Signup meta data. Default empty array.
 */
    apply_filters(
      'wpmu_signup_user_notification_email',
      /* translators: New user notification email. %s: Activation URL. */
      __( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login." ),
      $user_login,
      $user_email,
      $key,
      $meta
    ),
    site_url( "wp-activate.php?key=$key" )
  );

  $subject = sprintf(
    
/**
 * Filters the subject of the notification email of new user signup.
 *
 * @since MU (3.0.0)
 *
 * @param string $subject    Subject of the notification email.
 * @param string $user_login User login name.
 * @param string $user_email User email address.
 * @param string $key        Activation key created in wpmu_signup_user().
 * @param array  $meta       Signup meta data. Default empty array.
 */
    apply_filters(
      'wpmu_signup_user_notification_subject',
      /* translators: New user notification email subject. 1: Network title, 2: New user login. */
      _x( '[%1$s] Activate %2$s', 'New user notification email subject' ),
      $user_login,
      $user_email,
      $key,
      $meta
    ),
    $from_name,
    $user_login
  );

  wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );

  if ( $switched_locale ) {
    restore_previous_locale();
  }

  return true;
}
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 21st August 2020

Primary Sidebar

Information

Function name: wpmu_signup_user_notification
Plugin ref: WordPress
Version: 5.6
Sourcefile: wp-includes/ms-functions.php
File ref: wp-includes/ms-functions.php
Deprecated?: No
API Letters: N,S,U,W

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6
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:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


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

  • Home
  • Blog
  • Sitemap
  • Sites