Pro Site upgrade points to the main site

When I click on the Pro site upgrade button on a test site, it points to the main site and not the current site. I created a test user and logged in as that user. This user is an admin on this site, but when I click on Upgrade site I see the Pro Site status of the main site and not the test site.

Hope I explained it right.

  • Adam Czajczyk
    • Support Gorilla

    Hello Jaimie,

    I hope you're well today. Could you please grant me a support access to your site so I could take a closer look and likely find a solution to the problem?

    To grant access simply go to your "WPMU DEV dashboard" -> "Support" page -> "Support access" tab and click on "Grant access". You can find more information here:
    Please make sure to make a backup copy of your site first (our Snapshot plugin may be of help here).


  • Michael Bissett
    • Recruit

    Hey @Jaime,

    Ah phooey, the Support Access is giving me a invalid access token error when I try logging in. :slight_frown:

    Could you instead send in the following via our contact form:

    - Mark to my attention, the subject line should contain only: ATTN: Michael Bissett
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - Include WordPress network admin access details (login address, username & password)
    - Include FTP log-in details (hostname, username & password) - in case that's needed for further debugging, so we don't have to ask for that later (since you've been quite patient here already :slight_smile: )
    - Include any relevant URLs for your site

    On the contact form (linked to below), please select "I have a different question", this ensures it comes through and gets assigned to me.

    Thanks a bunch! :slight_smile:

    Kind Regards,

  • Michael Bissett
    • Recruit

    Hey @Jaime, thanks for sending that information in, and thanks for your patience here! :slight_smile:

    After having a closer look at things on your network, I see that you're using the Upgrade plugin that integrates Pro Sites with Gravity Forms:

    Just to confirm, could you try switching back to the default method provided by Pro Sites, and seeing if that works for subsite admins?

    Please advise,

  • Michael Bissett
    • Recruit

    Hey @Jaime, thanks for your patience here! :slight_smile:

    I had a feeling it might work with the normal Pro Sites form, thanks for confirming that. Given that Sybre was the one to create that integration plugin, I think we'll want to bring him into the discussion, and dig into this further.

    I've tagged him on that thread I mentioned, hopefully he's not too busy cooking up neat code. :slight_smile:

    Kind Regards,

  • Sybre Waaijer
    • The Incredible Code Injector

    Hello :slight_smile:

    The plugin mentioned on this page is a custom build, edited by me specifically for Jaime's needs.
    The problem is still the same as was mentioned earlier over mail with Jaime and I can not wrap my head around it.

    The plugin I wrote takes the user's primary site into account without an option to change the site. I should make an option though, it's in my to-do list :slight_smile:.


    The primary site can be changed within /wp-admin/my-sites.php as shown in the picture Jaime posted in the topic.
    Unfortunately, I do not see an option to change the primary site within the dashboard of Jaime's. This is the main problem.

    I'm not sure where this is related to and I can't spy into your site again to look for clues Jaime :p, you did a good job cleaning up (I still have FTP access though!) ^^,

    The plugins I wrote can't change the current user's role for a site or change the primary site of the user. So this has or had to be done somewhere else.

    Just to be clear:
    1. The super admin can't use the upgrade form through Gravity Forms. This is because the primary blog of the super admin is the main blog. The main blog has a bigger value than 63115200 (UNIX TIME, now + 2 years). However, the super admin won't be kicked out of the page, this is done for testing purposes on the end-user of my plugin. See note 1a.
    2. The plugin I wrote has been modified to Jaime's needs specifically through as I mentioned above.
    3. This is related to the user not having their registered site as their primary blog at signup. Note 3a shows the code I used on Jaime's website to register and bind the user's new site to pro sites.
    4. The big difference I see between Jaime's website and mine is the following line in wp-config.php. I'm unsure if this affects the outcome of the user's primary blog as I've never in-depth worked with sub-directories (I also strongly recommend using subdomains over subdirectories, but that's another story).
    define('SUBDOMAIN_INSTALL', false); //mine is true

    How this is solved, I'm unsure. This is why I asked Jaime to post the problem here =p Because I know the WPMUdev staff knows more about these issues ^^

    Anyway: The issue is that the user can't assign his primary blog and that it's automatically assigned to the main blog (

    Hope this helps and have a great day! If you need anything, please don't hesitate to ask ^^


    Note 1a. The code that determines if the user can upgrade.

    $user_blog_id = get_user_meta($user_id, 'primary_blog', true); // user's primary blog ID
    $user_is_admin = current_user_can_for_blog($user_blog_id, 'edit_pages'); // is the user editor or admin of the blog
    // if the site has less than 2 years of subscription time OR the user is super admin AND the user is admin of the blog: (I should rewrite this I think... =/)
    if ($protimesql < $max_1_year || is_super_admin() && $user_is_admin) {
    // show the form:
    $myformid = '9'; //upgrade form id
    echo do_shortcode( '[gravityform id="' . $myformid . '" name="Upgrade" title="true" description="false"]' );
    } else {
    // redirect to home page


    Note 3a. The code used to register the site. As you can see this this does nothing to the user's having a primary blog.
    $update_level gets fired through Pro Sites (global $psts:wink:.

    function enter_pro_site_level($site_id, $user_id, $entry, $config, $user_pass) {
    	global $wpdb,$psts;
    	$pstslevel =  strstr($entry['9'], '|', true);
    	$getperiod =  strstr($entry['10'], '|', true);
    	$getperiod .=  strstr($entry['11'], '|', true);
    /*	$getperiod .=  strstr($entry['12'], '|', true);*/
    	if ($getperiod == "termmonth") {
    		$pststime = strtotime("+1 month");
    		$pststimelastpayment = '1m'; /* new since 1.1.0 */
    	else if ($getperiod == "term3months") {
    		$pststime = strtotime("+3 month");
    		$pststimelastpayment = '3m'; /* new since 1.1.0 */
    	else if ($getperiod == "termyear") {
    		$pststime = strtotime("+1 year");
    		$pststimelastpayment = '1y'; /* new since 1.1.0 */
    	else {
    		$pststime = time();
    	/* new since 1.1.0 */
    	/* upgraded option = termtime level */
    	$upgraded_option = $pststimelastpayment . $pstslevel;
    	$pro_blog_option_upgrade = 'pro_site_last_payment';
    	add_blog_option($site_id, $pro_blog_option_upgrade, $upgraded_option);
    	$pstsgateway = 'GFormRegister';
    	$pststerm = '';
    	$pstsamount = '';
    		$update_level = $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->base_prefix}pro_sites (blog_ID, level, expire, gateway, term) VALUES (%d, %d, %d, %s, %s)", $site_id, $pstslevel, $pststime, $pstsgateway, $pststerm));
    	$psts->record_stat($site_id, 'upgrade');
    	$psts->log_action($site_id, __("GFormsRegister changed Pro-Sites level to Level ID {$pstslevel} with site_option ({$upgraded_option}).") );
    add_action("gform_site_created", "enter_pro_site_level", 10, 5);

    P.S. The upcoming 2 to 3 days I will be without land-line internet access since my provider thought: "Hey, let's stop giving 600/600 Mbit/s to citizens and sell our company to Vodafone... Oh, why not dump our customers on march the 31st? :smiley:"

  • Michael Bissett
    • Recruit

    Hey @Sybre, @Jaime,

    I just tried creating my own test site (inside of the WordPress Dashboard), and when logging in to the site, I found that the Pro Sites page I was directed to was showing the Pro Site details for the subsite, and not the main site.

    I also tried logging in as the test user that you sent me Jaime, and I found that when I viewed the Pro Sites account page for the demo site (that he was an admin for), that it too was having it's Pro Sites details shown properly.

    Was there something changed in the meantime? :slight_smile:

    Please advise,

  • Sybre Waaijer
    • The Incredible Code Injector

    Hello :slight_smile:

    I'll try to see if there's a permanent fix/workaround for this issue through my plugin, in the meantime the plugin I wrote could stay deactivated if you wish to do so.

    The user-interface version I'm going to make is going to have this workaround by default. Once again, undetermined ETA.

    To make use of the plugin I strongly suggest finding a fix regarding the primary blog issue, if it still persists. It's also very unique and I'm going to dig into the WP core for this issue. I'll keep you guys posted.

    But first, I need to fix IPv6, I noticed I missed a lot of traffic because of this D: (I has new interwebs ^^)

  • Jaime
    • Site Builder, Child of Zeus

    Hi @Michael Bissett. I will leave @Sybre's plugin disabled for now. Hopefully I can figure out the issue soon.
    On another note, I am currently getting an error when signing up. I haven't seen it affect anything other than show up once you sign up. Don't know what might be causing it. Any suggestions or ideas?

  • Adam Czajczyk
    • Support Gorilla

    Hey Jaime,

    I hope you're well today!

    The error that you're receiving is referring to our "PopUp Pro" plugin. Actually it's not even an error but just a php warning. That said, the question is if it affects the site's performance in any way?

    If the site (especially the signup process) works fine despite that error, I'd say that either you need to disable WP debugging or suppress php warnings.

    To disable WP debugging simply set

    define('WP_DEBUG', false);

    in you wp-config.php file.

    To suppress php warnings try setting

    php_flag display_errors off

    inside the .htaccess file.

    That being said, if aforementioned error results in site's malfunction it may mean that either the PopUp Pro plugin doesn't exist or the file popover.php was deleted or there's an issue with file permissions.

    I'm suppose though that it's just a matter of too strict warnings. Let me know please if debug/warning suppression solution worked for you.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.