Support » Plugins » Hacks » WP Multisite new user data store location

  • Hello All,

    Trying to find the storage location for new user registration data, specifically the subsite that a user registers on in WP Multisite.

    When new users register they receive an activation email. When the user clicks the activation link a notification email is sent to the site administrator with the following information; the Subject contains ‘New User Registration: username’. The email comes From: sitename and email address.

    Where is the ‘sitename’ that is entered into this email stored in the database?

    I need to access this data to be able to set the Default Role for new user Registrations.


    [ Signature moderated. ]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    I don’t use multisite, but this is what I think I know. Take with a grain of salt.

    The function that sends the mail is newuser_notify_siteadmin(). It uses wp_mail() to actually send the mail. wp_mail() is defined in wp-includes/pluggable.php. wp_mail() uses a passed header value for the from sitename, or ‘WordPress’ if no header is passed, as is the case with newuser_notify_siteadmin(). It does not come from the database. You can hook the filter ‘wp_mail_from_name’ and return any name you like.

    Same goes for the filter ‘wp_mail_from’ for the from email address.

    If your mail does not come from ‘WordPress’, your theme or some plugin (or multisite?) may have already hooked the mentioned filters. You can set your hook with a later priority to override other hooks. If that fails, you’ll have to find where it’s been previously hooked and remove that specific hook in your code.


    You wrote:
    “wp-includes/pluggable.php. wp_mail() uses a passed header value for the from sitename”

    I note: This is the crux of what I am looking for, the site name data.

    I see in pluggable.php the following”

    // Get the site domain and get rid of www.
    $sitename = strtolower( $_SERVER[‘SERVER_NAME’] );
    if ( substr( $sitename, 0, 4 ) == ‘www.’ ) {
    $sitename = substr( $sitename, 4 );

    So where is the site name stored that it is retrieving?

    [ Signature moderated. ]

    Moderator bcworkz


    $_SERVER[‘SERVER_NAME’] is a php global that gets assigned when php starts up. It gets a value from the server somehow as part of the startup process. Not sure how it actually gets done. Must be from DNS records or something?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP Multisite new user data store location’ is closed to new replies.