Automattic / Automattic/jetpack

Network: Subsite management issues when SITE_ID_CURRENT_SITE and BLOG_ID_CURRENT_SITE are not the same

Open
#7,436 2 comments 0 reactions 0 assignees View on GitHub
[Focus] Multisite [Pri] Low [Status] Stale Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

In a multisite network, with Jetpack network-activated, if the "root" site (e.g. example.com) and the "main" site (e.g. main.example.com) are not the same, the Connect/Disconnect links on the Sites screen are either unavailable or don't work unless they both have their own connection to wp.com.

#### Steps to reproduce the issue

1. In a multisite network (I've only tested with subdomains, so not sure if this applies to subdirectories as well), create a couple of subsites.
1. Designate one of the new subsites as the "main" site in the network by adding this to **wp-config.php**: `define( 'BLOG_ID_CURRENT_SITE', [site_id] );`. Maintain the parent site as the "root" site with `define( 'SITE_ID_CURRENT_SITE', 1 );`
1. Make sure the current user is an admin on both the "root" and "main" sites.
1. Network-activate Jetpack.
1. Try connecting either the "root" or the "main" site to wp.com, but not both.
1. Try to access the Jetpack Sites screen while in the Network Admin.
1. If you can reach the Jetpack Sites screen, try connecting/disconnecting the other subsites that aren't the "main" site. Even if it shows a message saying the connection was successful, check to see if the button actually changed from "Connect" to "Disconnect".

This was tested on the wordcamp.org network, with Jetpack 5.0, but with #7415 patch applied.

#### What I expected

I guess ideally, only the parent/"root" site would need its own connection to wp.com, and the "main" site would behave like other subsites.

#### What happened instead

I tried every combination of "root" and "main" site connections, and this is what I found:

---

connected: none
disconnected: root, main
* Jetpack Sites list: not available

---

connected: main
disconnected: root
* Jetpack Sites list: yes
* Disconnect a subsite: yes
* Connect a subsite: **no, but says yes**

---

connected: root
disconnected: main
* Jetpack Sites list: not available

---

connected: root, main
disconnected: none
* Jetpack Sites list: yes
* Disconnect a subsite: yes
* Connect a subsite: yes

Contributor guide

Open the contributing guide

Research direction

Reproduce the multisite setup in wp-config.php with different SITE_ID_CURRENT_SITE and BLOG_ID_CURRENT_SITE values, then inspect the Jetpack Sites screen in Network Admin. Compare Connect and Disconnect behavior for the root, main, and other subsites across the connection combinations described; done means the screen is available when appropriate and each action reports and reflects its actual result.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.