The MU forums have moved to

Getting wp-signup.php to pass site_id var. (8 posts)

  1. richardxthripp
    Posted 15 years ago #

    I'm using the Multi-Site Manager plugin and I want to let my users sign up for blogs at or for the respective domains. The only problem is that wp-signup.php or wpmu-functions.php always sets the site_id column in the wp_blogs table to 1, even though should have the site_id of 4. I've tested, and you can't even log on to an account until the site_id is changed manually.

    Is there any way to make this set itself automatically when a blog is created? All the other topics I've found here just suggest doing it manually in phpMyAdmin, but that doesn't work for my case (open registration).

  2. richardxthripp
    Posted 15 years ago #

    I solved this through a kludge: I added two lines below ” $result = wpmu_activate_signup($key);” in wpmu-activate.php:

    global $wpdb;
    $wpdb->query(”UPDATE $wpdb->blogs SET site_id = ‘4′ WHERE domain LIKE ‘’”);

    You can use that if you're facing my dilemma. Just change "" to your add-on domain and "4" to its site_id.

    My new problem, a more minor one, is that if say, is taken, no one can register, and vice-versa. If you have a solution for this, even if it's a hack, please post.

  3. MrBrian
    Posted 15 years ago #

    domain_exists in wp-includes/wpmu-functions.php is what checks if the blog is taken.

  4. richardxthripp
    Posted 15 years ago #

    Thanks, MrBrian. I saw that before, but I didn't notice that domain_exists is a part of create_empty_blog, which hard-codes the site ID to 1. domain_exists is then called by wpmu_create_blog which does the same, which is called by validate_another_blog_signup in wp-signup.php, which is used to create a new blog for a user who is already logged in. BUT, blog creation works fine when logged in; I can create even though exists, which is how it should be.

    Apparently the three instances of "$site_id = 1" in wpmu-functions.php do not matter at all. The problem is somewhere else. I'm still looking.

  5. lunabyte
    Posted 15 years ago #

    A quick grep of r1432 shows that while there is a function create_empty_blog in wpmu-functions.php, it's not called anywhere in the source.

    wpmu_create_blog on the other hand, is called in:

    ./wp-admin/wpmu-edit.php (with the correct call to current_site->id)
    ./wp-includes/wpmu-functions.php (without passing the site_id)
    ./wp-signup.php (with the current wpdb->site_id)

    The call which is not passing the site id at all is part of the wpmu_activate_signup function, on (or around) line 1124 or so (in r1432).

    To help the cause, and should clear it up:

  6. richardxthripp
    Posted 15 years ago #

    This doesn't let new users register same-named blogs on different domains, but it fixes the important problem. Thanks, lunabyte!

  7. lunabyte
    Posted 15 years ago #

    You're right. That doesn't let them pick. But if they arrive on site_id 2, that's what's going into the database. ;)

  8. jimgroom
    Posted 14 years ago #


    Did you ever find a solution for this? I am running up against the same issues, and would love to have the ability to allow users to sign-up for subdoamins on domain 2 that are already take on domain 1.

About this Topic

  • Started 15 years ago by richardxthripp
  • Latest reply from jimgroom