Add existing sites to Pro Sites, no Activation key

I am converting a very old website into a WordPress Multisite system. The old system was a subscription-based site, so I plan to implement Pro Sites to maintain that functionality on the new site. But of course, I have to migrate old sites and their subscriptions to this new site.

The ripple I’ve encountered is: because these sites have been created dynamically by batch, there is no wp_signup record for any of them. Looking through the activate_user_blog() function of Pro Sites, I see that it wants to grab that activation key to verify that the site is legitimate, I presume.

But in my case, there is no such record. So I’m unsure of how to proceed. I’m inclined to want to stick to the API for activating users, since it obviously does a lot of work. But without this key, I’ll be unable to continue.

One idea I had was to simply extend the ProSites class and rewrite that function without the check. But that seems like a dubious prospect.

Another answer I’ve though of is creating records in the database for all the sites I want to activate and just put garbage in the activation_key field.

Does any of this make sense, or am I reading the code wrong?

  • Vaughan
    • Support/SLS MockingJay

    Hi tbelknap

    The easiest option would be to just migrate the sites over to begin with, disregard pro-sites for nowuntil you have all the sites moved over & working.

    Pro sites has an option where you can turn a site into a pro-site. on the manage sites page.

    Once done you just turned that into a pro-site.

    Subscriptions you wouldn't be able to carry over though.

    Hope this helps

  • tbelknap
    • Flash Drive


    Thanks for the quick reply! The problem in this case (and why the sites were created dynamically) is because there are about 1000+ “blogs” to create. I’m afraid turning each one on – and setting their expiry time based on what they’ve already paid for their subscriptions – is not an option.

    I’m looking for a programmatic way to do this. Like I say, I see the function that I’d most likely want to use (correct?), but there is this one sticking point.


  • Panos
    • SLS

    Hi tbelknap ,

    I am not aware of how you have been working on this up to know, but in any case I think calling the signup_blog function would be the easiest path to follow.

    You could try the following:

    $pro_site_registrator = new ProSites_Helper_Registration;

    $result = $pro_site_registrator->signup_blog( $domain, $path, $title, $user, $user_email, $meta );


    $result = ProSites_Helper_Registration::signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta );

    As you see the signup_blog requires 6 parameters:

    1. $domain:

    $blog_validation = wpmu_validate_blog_signup( $blogname, $blog_title );

    $blogname and $blog_title are text vars

    then you can set:

    $blog       = $blog_validation;
    $domain = $blog['domain'];

    2. $path: Since we have set the $blog in first step:

    $path = $blog['path'];

    3. $blog_title: Similar:

    $blog_title = $blog['blog_title'];

    4 & 5: $user_name and $user_email I suppose you already have these

    6. $meta: An array:

    You can simply leave it blank like:

    $meta = array();

    or something like this:

    $meta = array( 'lang_id' => 1, 'public' => true );

    You can look up the signup_blog() function in plugin files.

    Hope this was helpful! Let us know if you require further assistance :slight_smile:

    Kind regards,


  • Panos
    • SLS

    Hi tbelknap ,

    Yes, you should be able to call activate_blog() since signup_blog() returns the activation code in an array:

    $result = array(
    'activation_key' => $key,
    'user_pass' => $password,

    So say you have already called

    $result = ProSites_Helper_Registration::signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta );

    Now you can provide the activation_key to activate_blog like:

    $signup_details = ProSites_Helper_Registration::activate_blog( $result['activation_key'], false, $period, $level );
    $blog_id = $signup_details['blog_id'];



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.